NetTalk Central

Author Topic: WebServer Init - Lockup When Running as a Service  (Read 4012 times)

David

  • Full Member
  • ***
  • Posts: 127
    • View Profile
WebServer Init - Lockup When Running as a Service
« on: December 29, 2009, 10:17:54 AM »
C7.1, NT5.PR5, WinEvent 3.65, SelfService 3.29, Win7 32bit.

When running my app as a service, code stops executing somewhere in the WebServer Init template generated code.  This does not happen if I run the app from the desktop.  I added lots of debug messages and the last entry I get is db.message('WebServer Init Priority 5000') just before the WebServer Init code.  There are no embeds in that code so I can not narrow it down any more.  Also notice that Clarion is up to Priority 8027 and then Nettalk adds Priority 5000.  Below is just a snippet of the template init code.

! [Priority 8027]
 
! Generated by NetTalk Extension (Start)

 ! Start of "NetTalk Object Before Init Section"
! [Priority 5000]
    db.message('WebServer Init Priority 5000')
 ! End of "NetTalk Object Before Init Section"
    do CheckOmittedWeb
    s_web &= ThisWebServer
    ThisWebServer.SuppressErrorMsg = 1         ! No Object Generated Error Messages ! Generated by NetTalk Extension
    ThisWebServer.init()
    ThisWebServer.Port = INIMgr.TryFetch('WEB', 'Port')
    ThisWebServer.Open()
    Get(ThisWebServer._SitesQueue,1)
  !---------------------------------
  s_web._SitesQueue.Defaults.WebHandlerProcName = 'WebHandler'
  s_web._SitesQueue.Defaults.DefaultPage = 'index.html'
  s_web._SitesQueue.Defaults.SessionExpiryAfterHS = 90001
  s_web._SitesQueue.Defaults.LoginPage = 'login.html'
  s_web._SitesQueue.Defaults.LoginPageIsControl = 0
  s_web._SitesQueue.Defaults.WebFolderPath = 'web'
  If instring('\',s_web._SitesQueue.Defaults.WebFolderPath,1,1) = 0
    s_web._SitesQueue.Defaults.WebFolderPath = clip(s_web._SitesQueue.defaults.appPath) & s_web._SitesQueue.Defaults.WebFolderPath
  End
  s_web._SitesQueue.Defaults.UploadsPath = clip(s_web._SitesQueue.Defaults.WebFolderPath) & '\uploads'
  s_web._SitesQueue.Defaults.HtmlCharset = 'ISO-8859-1'
  s_web._SitesQueue.Defaults.LocatePromptText = s_web.Translate('Locate')
  s_web.MakeFolders()
  s_web._SitesQueue.defaults.AllowAjax = 1
  s_web._SitesQueue.defaults._CheckForParseHeader = 1         ! Check for Parse Header String

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: WebServer Init - Lockup When Running as a Service
« Reply #1 on: December 29, 2009, 07:45:46 PM »
My guess is that the INIMGR is not pointing to the place you think it's pointing to.

Perhaps log the value of INIMgr.TryFetch('WEB', 'Port') and see if it's what you think it is.

cheers
Bruce

David

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: WebServer Init - Lockup When Running as a Service
« Reply #2 on: December 30, 2009, 06:59:51 AM »
I logged the value of INIMgr.TryFetch('WEB', 'Port') just before the WebServer Init and the result is 443, which is what it is supposed to be. 

The lockup only occurs if the app is run as a service.

David

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: WebServer Init - Lockup When Running as a Service
« Reply #3 on: December 30, 2009, 10:26:06 AM »
OK, so I turned on logging (/netall) and the following is the output.  The last NetTalk entry is the .open method.

[Net] [3]  - Using NetTalk (Object) version 5.00 in application c:\pwstore\pwstore.exe   
[Net] [3]  - NetTalk (Object) Information: Net:MaxBinData = 16384 Size(Net:PacketType) = 16956 Size(Net:PublicServicesQType) = 596 Size(Net:ServiceType) = 348 Size(Net:RemoteType) = 148   
[Net] [3]  - NetTalk (Object) using Clarion 7.1   
[Net] [3] _NetAll._LoggingSetup - Initialisation   
[Net] [3] NetSimple.Init - Initialising a new Server   
[Net] [3] NetWebServer._FreeConnectionDataQueue - _FreeConnectionDataQueue   
[Net] [3] NetSimple(Server).Open - Attempting Listen on TCP Port 443   
[Net] [3] NetSimple.Open - Will use Asynchronous Open. Timeout (hs) = 1200   
[Net] [3] NetSimple(Server).Open - Will use InActive (Idle) Timeout (hs) = 6000   

If I run the app from the desktop, then I get the additional message and my app runs
[Net] [2] NetSimple(Server).Open - Successfully listening on TCP Port = 443 On socket = 636 SockID = 1

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: WebServer Init - Lockup When Running as a Service
« Reply #4 on: December 31, 2009, 04:38:43 AM »
perhaps it's being blocked by the windows firewall or anti-virus on the machine?
I can see that they would treat Service apps differently to Desktop apps.

cheers
Bruce

David

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: WebServer Init - Lockup When Running as a Service
« Reply #5 on: January 12, 2010, 12:20:35 PM »
Bruce,

I just had a client update my app that was running fine on their server(they do beta testing for me).  It is now hanging when run as a service, which is how they have always run it.  I have them running it as a desktop app, but this is not an ideal solution.

It is hanging at the NetSimple.Open as stated in my previous post.  The previous version of my app that was running correctly was compiled with NT4.  They are running my app on a Windows 7 workstation.

What can I do next.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: WebServer Init - Lockup When Running as a Service
« Reply #6 on: January 12, 2010, 08:41:05 PM »
try disabling virus scanners, firewalls, etc on the machine till you find the culprit.
Also try on other machines (especially a non-windows 7 machine) to see if you get the same effect.

cheers
Bruce

David

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: WebServer Init - Lockup When Running as a Service
« Reply #7 on: January 18, 2010, 07:13:35 PM »
Bruce,

I tried a Windows 2003 server and Windows XP.  Both fresh installs, no antivirus, no firewall.  Other than the OS and patches, my app was the only thing installed.  It froze at the same place.

[Net] [3] NetSimple(Server).Open - Will use InActive (Idle) Timeout (hs) = 6000 

Again, the freeze only happens when run as a service.  As a desktop app, it works fine.  I also ran the service as a local administrator to see if it was some kind of permissions issue.  But no luck. 

Are there any additional trace messages you can add in the open method that could narrow this down?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: WebServer Init - Lockup When Running as a Service
« Reply #8 on: January 18, 2010, 09:05:12 PM »
send me the exe, and needed support files (data, DLL's, web folder etc).
Make sure it's compiled in "Stand-Alone" (now called DLL) Mode.

I'll try installing on my machine as a service, and see where we go from there.

cheers
Bruce

David

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Re: WebServer Init - Lockup When Running as a Service
« Reply #9 on: January 22, 2010, 02:35:34 AM »
Bruce,

In trying to prepare my app to send you, I went back through and did another set of test.  And guess what.... my app locked up, but not on the NetSimple(server).Open method but earlier in the program.  On 3 different computers and multiple times, my app appeared to lockup at the NetSimple.Open method.  And now it starts locking up in the MAIN window init.   After several hours of debugging and commenting out huge sections of my embedded code, I still was no closer to figuring it out.  So I deleted my main procedure window, recreated it, pasted my embed code back into it and now everything is working.

So, it had nothing to do with NT5, which you already knew and where being kind in trying to help.  I hate it when a problem goes away and I don't know why.  Thank you again for your assistance.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: WebServer Init - Lockup When Running as a Service
« Reply #10 on: January 22, 2010, 05:16:42 AM »
well at least it's sorted - that's the main thing.

cheers
Bruce