NetTalk Central

Author Topic: webserver shutdown  (Read 6824 times)

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
webserver shutdown
« on: October 11, 2010, 02:40:49 PM »
I posted about this before, but things have changed enough so I am posting again.
Running Nettalk 5 in C72.7653I have a multi-dll app. it had 11 DLLs and up until last week was working along pretty well.
Then it would throw an exception 05 - access violation.
When I compiled it with debug turned on so I could use GPF reporter, it stopped GPFing and started just closing. No log entry, no error message, the server would just close.
I have since written a new a new very bare bones webserver main exe, with only the data dll and a login dll.
The main exe has only an index page with xhtml that shows a title and a link to the login.
The login, looks up to user, validates the password when the webserver loads the index page it shuts down.

I have ds_debug messages in place that show that the login was successful and the procedure has ended so that the webserver would then be waiting for the next event.

I have been at this for several days, and now with this very simple example failing, I am at a loss as to what to try next.
I did have GPF reporter in place, but since there is no GPF, I took it out as well.
It also used to give me an assert message about using close instead of filemanager.close it doesn't do that either.
I am using FM3, MessageBox,NetTalk, NetTalk webserver, FreeImage, Version Resource in the  Data Dll.

If anyone has a suggestion . . .

Thanks
chris

<Edit> - I have just changed the build configuration to Release and it seems to be working... why don't I feel any better about that?
« Last Edit: October 11, 2010, 02:44:02 PM by ccordes »
Real programmers use copy con newapp.exe

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: webserver shutdown
« Reply #1 on: October 11, 2010, 05:49:47 PM »
Here I go answering my questions -  I gave up. Took a break.
I am running in debug and have a problem and in release don't have a problem. So the problem must be in a line with  a ? in col 1 - asserts. But I'm not getting a message And it isn't GPF'ing.
That's because I am using MessageBox in the data DLL! I have the timer set to a global variable but in my test stuff I didn't bother to load them. So the message timer is 0. Messagebox uses the default button on messages.
Turning off message box, I find that the default button on the ABFILE assert that the open count-is-0-and-your-file-is-still-open assert message is --- Close Application!!

So it comes back to an earlier question of mine and others - When do you use access:file.something and p_web._somefileCommand or open,get,next,close? If the filemanage class is aware that the file is open and the count is 0 then was the filemanager used to open, close or access the table?

Has anyone else come across this? How have you handled it? Comment out all the asserts? ::)

Thanks,
chris
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: webserver shutdown
« Reply #2 on: October 12, 2010, 09:21:07 AM »
Hi Chris,

If you have a small sample app that duplicates the problem, then maybe you can send it to me?

>> So it comes back to an earlier question of mine and others - When do you use access:file.something and p_web._somefileCommand or open,get,next,close?

In ABC the p_web just calls the Access stuff, so I personally always just use the Access stuff in my own code.

>> Has anyone else come across this? How have you handled it? Comment out all the asserts? Roll Eyes

It's not the asserts - unless you have an assert appearing - but perhaps if you send me the example I can take a look for you.

cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: webserver shutdown
« Reply #3 on: October 12, 2010, 12:05:50 PM »
Thanks Bruce. I will send you the minimal sample I am testing on if I can bundle it up for you.
I felt that too because I had no asserts appearing...until I turned off messagebox. then I got one about files not being closed.
I just ran the full app again thinking I had sorted this out ... crash. This time I did get a GPF report.

Watch your email

Chris
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: webserver shutdown
« Reply #4 on: October 12, 2010, 12:26:08 PM »
Hi Chris,

I'm bouncing about a bit the rest of this week. I'm flying into the US tomorrow - which is a whole-day event, then flying from Denver to Boston on Thursday, also pretty much a whole day event. Friday I'm in training, and I've got a conference this weekend. Then back to Denver on Monday - so it may be a few days before I can look at the app - but I'll get there in the end.

Cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: webserver shutdown
« Reply #5 on: October 12, 2010, 12:43:48 PM »
Oh right!
When I started this project, I had hoped that I'd be done by now and be able to go out to Denver. Now here I am. Looks like I should've planned on going anyway and I'd have been there!

This is a real show stopper.

Chris
Real programmers use copy con newapp.exe

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: webserver shutdown
« Reply #6 on: October 12, 2010, 04:27:50 PM »
Chris you should have booked. The nettalk training for me was invaluable and the docs we got with training I call the bible - it covers all the basics and all the advanced stuff I never understood. I wish I had it 2 years ago! I was also able to get Bruce to look at some specific problems I was having during optional sessions.

Cheers,

Kev

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: webserver shutdown
« Reply #7 on: October 14, 2010, 03:30:39 PM »
it's still possible to sign up - even online if you can't physically get to denver.

cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: webserver shutdown
« Reply #8 on: October 14, 2010, 04:02:19 PM »
oh yeah...

Denver aside, I think I have tracked down my problem.
The messagebox issue is a redherring. Not that it isn't a problem in killing the asserts and stopping the program, it is,b ut the big problem showed itself in the GPF reporter. The error showed up all over the place the top 2 or three procedures were always different. And the errors came right after setsessionvalue call. It didn't matter what value or where it was.
To help in debugging other things I had put in a local session queue in the webserver with just 3 fields session, name and value. So I could keep track of what was going on, I put a sheet and tab with a list to show all sessionvalue activity. As long as I was by myself, the only error  was the file close assert. When 2 people were on it crashed much more frequently but with out the assert message.
The problem was my updating the global queue of session values. I forgot to wrap them in a critical section to stop them from being updated while being updated. p_web._wait() and _release() fixed it.
The server has been up for 10 hours with 1600 page views no crash and plenty of activity.

The lesson of the story - be careful when you add stuff to the web server!!! Those threads don't live long but they go everywhere!

Chris
Real programmers use copy con newapp.exe

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: webserver shutdown
« Reply #9 on: October 14, 2010, 04:26:40 PM »
This problem was covered in Bruce's training. I haven't had to hack into the Session Q but the training and documentation covers it step by step so if I ever needed to do it I now know how. That is just one example.

Cheers,

Kev

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: webserver shutdown
« Reply #10 on: October 15, 2010, 09:42:47 AM »
Hi Chris,

embedding in the WebServer procedure is generally not idea, partly because of the thread-safety issues (and queues are definitely not thread safe) but also because when it comes to hosting multiple web server apps, on the same IP and port (using the Host.exe, see Multi-Site example) then the code in the WebServer doesn't apply.

So with NetTalk 5 we've been moving the common embed points in the WebServer procedure (DeleteSession and MakeErrorPage for example) into the WebHandler.

So for both reasons try, where possible, to avoid the WebServer. And yes, of course, use _wait and _Release whenever accessing the WebServer object directly.

Cheers
Bruce