Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Main code sometimes doesn't continue after response window closes

3 posts in General Discussion Last posting was on 2013-03-10 14:13:38.0Z
Dan Posted on 2013-03-08 17:18:24.0Z
Sender: 5d7c.513a029e.1804289383@sybase.com
From: Dan
Newsgroups: sybase.public.powerbuilder.general
Subject: Main code sometimes doesn't continue after response window closes
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <513a1d60.68e2.1681692777@sybase.com>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 8 Mar 2013 09:18:24 -0800
X-Trace: forums-1-dub 1362763104 172.20.134.41 (8 Mar 2013 09:18:24 -0800)
X-Original-Trace: 8 Mar 2013 09:18:24 -0800, 172.20.134.41
Lines: 78
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:249848
Article PK: 1308226

I have an application that has always worked fine for me,
but one client recently started reporting that the app was
hanging intermittently.

I built a version of the app that would provide a lot of
extra logging, and the best I can figure is that it is
hanging after calling the CloseWithReturn method on a
response window.

The app code works as follows:

application.open:
...
gf_log("Opening w_login")
OpenWithParm(w_login, ...)
gf_log("Closed w_login")
...

w_login.open:
// can be used for manual logons or automated logons
// used as a "splash" screen for automated logons
// issue has only occurred when using automated logon
gf_log("Start")
...
gf_log("End")

w_login.show:
gf_log("Start")
...
timer(.1) // allow window to finish opening and start
autologin timer
...
gf_log("End")

w_login.timer:
gf_log("Start")
timer(0)
...
post event ue_autologin(...)
gf_log("End")

w_login.ue_autologin:
gf_log("Start")
if not i_nvLogin.Trigger Event ue_login(...) then
gf_log("Error:")
...
else
gf_log("Successful login")
TriggerEvent("ue_close")
end if
gf_log("End")

w_login.ue_close:
closewithreturn(this, i_lErrCode)

w_login.close:
message.doubleparm = i_lErrCode
message.stringparm = i_sError
destroy(nv_login)

nv_login.destructor:
gf_log("Destructor")


I can tell from what got logged that all the events fired
correctly, the only difference between a log from a hanging
run vs a log from a successful run is the "Closed w_login"
from the application open event (the hanging runs never log
this.) As I said, this issue is intermittent and has
occurred in almost all runs for this particular client
between Dec and about a week ago when I sent the new logging
code. Since I sent the code, the first run (out of 8
subsequent runs) experienced the hanging issue.

I know my code could be structured a bit better, and perhaps
I will improve it a bit in the future, but for now I am
wondering if anyone has seen/heard of such an issue or has
an ideas why it might be happening.


Dan Posted on 2013-03-08 20:22:00.0Z
Sender: 5d7c.513a029e.1804289383@sybase.com
From: Dan
Newsgroups: sybase.public.powerbuilder.general
Subject: Re: Main code sometimes doesn't continue after response window closes
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <513a4868.7b6c.1681692777@sybase.com>
References: <513a1d60.68e2.1681692777@sybase.com>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 8 Mar 2013 12:22:00 -0800
X-Trace: forums-1-dub 1362774120 172.20.134.41 (8 Mar 2013 12:22:00 -0800)
X-Original-Trace: 8 Mar 2013 12:22:00 -0800, 172.20.134.41
Lines: 27
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:249851
Article PK: 1308231

Writing this gave me some ideas to try out and I think I
have identified the issue:

I am using hacked together statictext userobject that so its
text can have a transparent background. The object has the
following paint event:

if IsValid(this) then

if ib_Painting then return 0
ib_Painting = TRUE
this.visible = false
do while yield(); loop
if IsValid(this) then
this.visible = true
ib_painting=false
end if
end if
return 0


My use of the timer above was to ensure that this event had
time to fire. I think the issue was that in some cases the
.1 second timer wasn't enough time for this to fire, and
therefore it would fire after the window closed, thus
entering an infinite loop; adding a check to the loop to
make sure the parent is valid seems to fix the issue.


Jeremy.Lakeman Posted on 2013-03-10 14:13:38.0Z
Sender: 53dd.513c88ea.1804289383@sybase.com
From: Jeremy.Lakeman@gmail.com
Newsgroups: sybase.public.powerbuilder.general
Subject: Re: Main code sometimes doesn't continue after response window closes
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <513c9512.5674.1681692777@sybase.com>
References: <513a4868.7b6c.1681692777@sybase.com>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 10 Mar 2013 06:13:38 -0800
X-Trace: forums-1-dub 1362924818 172.20.134.41 (10 Mar 2013 06:13:38 -0800)
X-Original-Trace: 10 Mar 2013 06:13:38 -0800, 172.20.134.41
Lines: 40
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.general:249856
Article PK: 1308240

That's a good rule of thumb, always check for object
destruction / closure after a yield().

You could even generalise that pattern with exception
handling to ensure the caller deals with any potential
issues;

subroutine yield_valid(powerobject test) throws ...
do while yield(); loop
if not isvalid(test) then
throw ...
end if

> Writing this gave me some ideas to try out and I think I
> have identified the issue:
>
> I am using hacked together statictext userobject that so
> its text can have a transparent background. The object
> has the following paint event:
>
> if IsValid(this) then
>
> if ib_Painting then return 0
> ib_Painting = TRUE
> this.visible = false
> do while yield(); loop
> if IsValid(this) then
> this.visible = true
> ib_painting=false
> end if
> end if
> return 0
>
>
> My use of the timer above was to ensure that this event
> had time to fire. I think the issue was that in some
> cases the .1 second timer wasn't enough time for this to
> fire, and therefore it would fire after the window closed,
> thus entering an infinite loop; adding a check to the loop
> to make sure the parent is valid seems to fix the issue.