Win32::OLE

Win32::OLE

am 08.03.2007 01:18:22 von NBharucha

This is a multi-part message in MIME format.

--===============0346822961==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C76117.496C8D95"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C76117.496C8D95
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi All,

=20

I have code that has been in Production for almost 2 years running many
times per day flawlessly. I am interacting with a 3rd party DLL (WS_FTP
Secure Dev Kit) which acts as a COM server. About 1.5 months ago and
yesterday the DLL caused my Perl exe to crash; the crash should have
been trapped by eval blocks, but wasn't...

=20

=20

Here is the sub (OO Method) where I execute the new method:

=20

# Create a new WSFTP API object #

sub createWSFTPComObject

{

my $self =3D shift;

my $objRef =3D Win32::OLE->new('WsftpSDK.WsftpApi') || die
"\nWSFTP.pm - Unable to instantiate WS_FTP API object, error: $!";

if ($objRef == undef)

{

print "\nWSFTP.pm - Unable to create WS_FTP API
Object!";

die "\nWSFTP.pm - $!";

}

=20

if ($self->{_displayMode} == 3)

{

print "\nWSFTP.pm - Created WS_FTP API Object "
.. $objRef;

}

=20

return $objRef;

}

=20

I am using ActivePerl 5.8.4.810 packaged to an exe using PDK 5.3. The
code is running on a Windows 2003 server. =20

=20

=20

=20

Thanks,

=20

Nick B.


------_=_NextPart_001_01C76117.496C8D95
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">


charset=3Dus-ascii">









style=3D'font-size:10.0pt;
font-family:Arial'>Hi All,



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>I have code that has been in Production for almost 2 =
years
running many times per day flawlessly.  I am interacting with a =
3rd
party DLL (WS_FTP Secure Dev Kit) which acts as a COM server.  =
About 1.5
months ago and yesterday the DLL caused my Perl exe to crash; the crash =
should have
been trapped by eval blocks, but =
wasn’t…



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>Here is the sub (OO Method) where I execute the new =
method:



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'># Create a new WSFTP API object =
#



style=3D'font-size:10.0pt;
font-family:Arial'>sub createWSFTPComObject



style=3D'font-size:10.0pt;
font-family:Arial'>{



style=3D'font-size:10.0pt;
font-family:Arial'>         =
   my
$self =3D shift;



style=3D'font-size:10.0pt;
font-family:Arial'>         =
   my
$objRef =3D Win32::OLE->new('WsftpSDK.WsftpApi') || die =
"\nWSFTP.pm -
Unable to instantiate WS_FTP API object, error: =
$!";



style=3D'font-size:10.0pt;
font-family:Arial'>         =
   if
($objRef == undef)



style=3D'font-size:10.0pt;
font-family:Arial'>         =
   {



style=3D'font-size:10.0pt;
font-family:Arial'>         =
            &=
nbsp;  print
"\nWSFTP.pm - Unable to create WS_FTP API =
Object!";



style=3D'font-size:10.0pt;
font-family:Arial'>         =
            &=
nbsp;  die
"\nWSFTP.pm - $!";



style=3D'font-size:10.0pt;
font-family:Arial'>         =
   }



style=3D'font-size:10.0pt;
font-family:Arial'>         =
  



style=3D'font-size:10.0pt;
font-family:Arial'>         =
   if
($self->{_displayMode} == 3)



style=3D'font-size:10.0pt;
font-family:Arial'>         =
   {



style=3D'font-size:10.0pt;
font-family:Arial'>         =
            &=
nbsp;  print
"\nWSFTP.pm - Created WS_FTP API Object " . =
$objRef;



style=3D'font-size:10.0pt;
font-family:Arial'>         =
   }



style=3D'font-size:10.0pt;
font-family:Arial'>         =
  



style=3D'font-size:10.0pt;
font-family:Arial'>         =
   return
$objRef;



style=3D'font-size:10.0pt;
font-family:Arial'>}



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>I am using ActivePerl 5.8.4.810 packaged to an exe =
using PDK
5.3.  The code is running on a Windows 2003 server.  =



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>Thanks,



style=3D'font-size:10.0pt;
font-family:Arial'> 



style=3D'font-size:10.0pt;
font-family:Arial'>Nick B.









------_=_NextPart_001_01C76117.496C8D95--

--===============0346822961==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0346822961==--

RE: Win32::OLE

am 08.03.2007 12:21:22 von Brian Raven

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Bharucha, Nikhil
Sent: 08 March 2007 00:18
To: activeperl@activestate.com
Subject: Win32::OLE =


> Hi All,
> =

> I have code that has been in Production for almost 2 years running
many times per day flawlessly. I am =

> interacting with a 3rd party DLL (WS_FTP Secure Dev Kit) which acts as
a COM server. About 1.5 months ago and > yesterday the DLL caused my
Perl exe to crash; the crash should have been trapped by eval blocks,
but wasn't...

Which begs the question, what do you mean by crash. An eval block could
be used to trap a die, but not a crash as I understand the term. Also, I
see no eval in the code you provide.

> =

> Here is the sub (OO Method) where I execute the new method:
> =

> # Create a new WSFTP API object #
> =

> sub createWSFTPComObject
> {
> my $self =3D shift;
> my $objRef =3D Win32::OLE->new('WsftpSDK.WsftpApi') || die
"\nWSFTP.pm - Unable to instantiate WS_FTP > API object, error: $!";

The following if statement is redundant as the statement above already
tests for undef. Also, it is more usual to use the function 'defined'.
Also, consider using Win32::OLE->LastError, which may give more relevant
info than $!.

> if ($objRef == undef)
> {
> print "\nWSFTP.pm - Unable to create WS_FTP
API Object!";
> die "\nWSFTP.pm - $!";

Are you aware that the above two statements direct their output to
different streams (STDOUT and STDERR), which may well end up in
different places?

> }
> =

> if ($self->{_displayMode} == 3)
> {
> print "\nWSFTP.pm - Created WS_FTP API Object
" . $objRef;
> }
> =

> return $objRef;
> }
> =

> I am using ActivePerl 5.8.4.810 packaged to an exe using PDK 5.3. The
code is running on a Windows 2003 =

> server. =


I suspect that this problem could be a little difficult to track down
unless you can reproduce it with a better frequency that 1.5 months. If
you could create a script that reproduces the problem more reliably it
would help a lot. It may even lead to you discovering the problem for
yourself.

As a small aside, you seem to have your line end character (i.e. "\n")
at the wrong end of your lines ( :-) )

HTH

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Win32::OLE

am 08.03.2007 17:24:07 von NBharucha

I believe I forgot that Win32::OLE runs in-process (duh), so a crash of an =
object created (or attempted to be created) will bring down the caller as w=
ell.

I agree about the redundancy in messaging for a new method failure, one of =
those things as well (not sure if all of the methods were available 2 years=
ago...).

The top level script opens separate filehandles for STDOUT and STDERR.

I have upped logging (configurable) so that my code turns on the Debug mode=
in the WSFTP SDK. Every connection is logged to a separate file, but when=
the failure does occur again I will probably find that it is truncated as =
well due to the write buffer not being flushed due to a crash.

I agree about the EOL character, trust me the way the logs are formatted it=
works better this way :)


Thanks,

Nick



-----Original Message-----
From: activeperl-bounces@listserv.ActiveState.com [mailto:activeperl-bounce=
s@listserv.ActiveState.com] On Behalf Of Brian Raven
Sent: Thursday, March 08, 2007 6:21 AM
To: activeperl@activestate.com
Subject: RE: Win32::OLE =


From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of
Bharucha, Nikhil
Sent: 08 March 2007 00:18
To: activeperl@activestate.com
Subject: Win32::OLE =


> Hi All,
> =

> I have code that has been in Production for almost 2 years running
many times per day flawlessly. I am =

> interacting with a 3rd party DLL (WS_FTP Secure Dev Kit) which acts as
a COM server. About 1.5 months ago and > yesterday the DLL caused my
Perl exe to crash; the crash should have been trapped by eval blocks,
but wasn't...

Which begs the question, what do you mean by crash. An eval block could
be used to trap a die, but not a crash as I understand the term. Also, I
see no eval in the code you provide.

> =

> Here is the sub (OO Method) where I execute the new method:
> =

> # Create a new WSFTP API object #
> =

> sub createWSFTPComObject
> {
> my $self =3D shift;
> my $objRef =3D Win32::OLE->new('WsftpSDK.WsftpApi') || die
"\nWSFTP.pm - Unable to instantiate WS_FTP > API object, error: $!";

The following if statement is redundant as the statement above already
tests for undef. Also, it is more usual to use the function 'defined'.
Also, consider using Win32::OLE->LastError, which may give more relevant
info than $!.

> if ($objRef == undef)
> {
> print "\nWSFTP.pm - Unable to create WS_FTP
API Object!";
> die "\nWSFTP.pm - $!";

Are you aware that the above two statements direct their output to
different streams (STDOUT and STDERR), which may well end up in
different places?

> }
> =

> if ($self->{_displayMode} == 3)
> {
> print "\nWSFTP.pm - Created WS_FTP API Object
" . $objRef;
> }
> =

> return $objRef;
> }
> =

> I am using ActivePerl 5.8.4.810 packaged to an exe using PDK 5.3. The
code is running on a Windows 2003 =

> server. =


I suspect that this problem could be a little difficult to track down
unless you can reproduce it with a better frequency that 1.5 months. If
you could create a script that reproduces the problem more reliably it
would help a lot. It may even lead to you discovering the problem for
yourself.

As a small aside, you seem to have your line end character (i.e. "\n")
at the wrong end of your lines ( :-) )

HTH

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs