NetTalk Central

Author Topic: GPF when sending emails Pt4  (Read 4904 times)

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
GPF when sending emails Pt4
« on: October 03, 2012, 11:34:39 AM »
Reposted here becuase the threads not showing anything again:
When I last looked at the API calls the clarion runtime was doing, in C7/8 after the thread was started it went to sleep for upto 250 milliseconds or just went sleep(0) to pass CPU processing back to the OS and other apps. This is what I use to monitor the API calls in dlls and so on, its very eye opening and useful! http://www.rohitab.com/apimonitor

I havent looked at the API calls NT makes yet but is the callbackwindow starting on its own thread? The debugview comments suggest to me it is so could you not build something into NT like I've done in the example apps where it posts events only once an event has passed through the accept loop? Just like what you got me to do with the example apps I've knocked together to demonstrate this problem. BTW you can still get a GPF in C7/8 if you start threads too quickly so I'm surprised you have not seen this in C8 but then you didnt see the C6 gpf's either so theres a difference in PC's at the very least.

It does raise eyebrows when I see comments like it could be a "timing issue" because in a multithread environment one would hope its not relying on time alone to handle what should be interthread communication or posting WM messages to different threads to trigger different actions in other threads.

Re "One tip with the other forums is not to open multiple tabs to the forums at the same time. doing that can cause interesting behaviours."

I wasnt opening different webpages on different tabs at least I dont think I was, but as your other forum is written in Nettalk, I guess our users will also see "interesting behaviours" if they or their customers/users/what-have-you open pages on multiple tabs as well, thanks for the heads up!

Will this be addressed soon as I've got to make an update to a NT webserver which is going to be used by both handhelds (ce.net), smartphones (iphones, blackberry & androids) as well as desktop pc's for a company and one of the points mentioned was the ability to have different webpages open on different tabs. This "interesting behaviour" could scupper this project if its behaviour is too interesting and whilst I dont want to redo this server from scratch in something else, if your workload or the scale of the problem doesnt permit a resolution anytime soon, it might be quicker to port this to something else so if you can give an accurate or best guess idea of timescales this will help me plan ahead and potentially avoid disappointing the customer suffering more losses.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: GPF when sending emails Pt4
« Reply #1 on: October 03, 2012, 11:57:08 PM »
>> the ability to have different webpages open on different tabs.

the first thing to bear in mind is that the browser does not identify the tab when it sends a request. Since all tabs use the same cookies, they hence have the same session ID. Thus the server cannot distinguish between the request from one tab, and the request from another.

What this means is that, while you can open multiple tabs, you can't open the same browse in two tabs. Well, you can, but the second one overwrites the session values of the first which makes it "strange". As long as you are openeing different browsers you're ok.

So, as an example, when doing ClarionShop administration I regulalry have multiple tabs open - one for orders, one for products, one for customers and so on. But, as a contrast, the forum software only has "one browse" (the topics) so I can't open the forums front page in multiple tabs.

Now it's a _possibility_ (although nothing is certain yet) that I may have found a clever work-around which allows the tabs to be identified, but this requires some under-the-hood changes so will only _possibly_ be available in Nt7. And I'm not sure yet if it will work in all browsers, or only some of them.

cheers
Bruce


useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: GPF when sending emails Pt4
« Reply #2 on: October 04, 2012, 12:46:12 AM »
>the first thing to bear in mind is that the browser does not identify the tab when it sends a request. Since all tabs use the >same cookies, they hence have the same session ID. Thus the server cannot distinguish between the request from one tab, >and the request from another.

Ok I see the problem, what I would suggest is for want of a better description a super sessionID, in that each webpage opened gets its own sessionid and either through the use of cookies and/or the server maintaining a list of sessionID's spawned from the initial sessionid.

If a session times out it, it times out no change of behaviour there but if the server can keep track of each webpage opened by giving each webpage its own unique sessionid which is tied in someway back to the initial sessionid it should be able to handle the use of multiple browser instances running as well as each tab them. Is that the sort of line of thinking you have in mind?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: GPF when sending emails Pt4
« Reply #3 on: October 04, 2012, 02:06:43 AM »
This falls into the category of "it's not as simple as that".

firstly, all cookies are "across all tabs" so cookies can't be part of the solution.

secondly, a single "page" can contain lots and lots of procedures. (popups do not change the page for example) so there's no relationship between "page" and "procedure".

thirdly, in order to "tell" the server which tab it's on, there has to be some sort of "tab id" setting it can use. (and you guessed it, there's no such thing). Now it's _possible_ that window.name can be used for this purpose, but that's only the tip of the iceberg.

Assuming window.name can identify the page, then two major issues arise. first the name has to be passed with each ajax request (although it will change on every new _page_) and on the server side there has to be a way of separating session values based on the page name, but at the same time allowing the values to flow from one page to the next.

Like I said, it's only a possibility, and I'm not sure if it can be made to work.

cheers
Bruce

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: GPF when sending emails Pt4
« Reply #4 on: October 04, 2012, 02:50:21 AM »
>This falls into the category of "it's not as simple as that".
I hear that often usually to justify more expenditure.  ;D

>firstly, all cookies are "across all tabs" so cookies can't be part of the solution
Cookies are just another data store, can the cookie not be renamed in NT or is it a fixed value?

>Assuming window.name can identify the page, then two major issues arise. first the name has to be passed with each ajax request (although it will change on every new _page_) and on the server side there has to be a way of separating session values based on the page name, but at the same time allowing the values to flow from one page to the next.

If the Window.Name is changing on each new page, then sessionID and window.name is all I will need to make it work across multiple tabs and/or opened in a new browser window.

Anyway I wont take up any more of your time debating this, as I need to get this problem with Nettalk GPFing when sending emails sorted as its dragged on long enough proving the bug is in your software.

BTW some users running an older C6 app with NT4 in have also been able to reproduce this problem, in this instance, I got them to open a window with a browse on it and an option (button) to send an email. They have opened two instances of this window side by side, if they click the Email button in quick succession it GPF's if both buttons are clicked within 1sec of each other. Granted not the usual way a user works, but it just demonstrates the problem exists in NT and has done since NT4 but I think its clear this callbackwindow starting up needs to have some WM event management in place so it can work in a multithreaded environment becuase the Sleep(x) workaround SV have put in place in the C7/8 when starting a new thread to prevent it from GPF'ing is not a fix.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: GPF when sending emails Pt4
« Reply #5 on: October 04, 2012, 05:37:30 AM »
add

Netoptions(NET:GETHOSTIPLIST,str)

to the Event:openWindow event in the Main procedure
where str is just a string.

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: GPF when sending emails Pt4
« Reply #6 on: October 04, 2012, 07:06:13 AM »
It works for all the example apps, I can upload this to the customer now which will get them off my back. Thanks!

BTW I did a count up the other day to see how many emails they send during the day, a little over 10k but they can peak as high as 32 emails a second all fitting down 2 bonded 4Mb broadband lines which is the best they can get, which is being used for web access, and remote staff as well, so this will please them enormously because they cant get fibre like my 64mb fibre I have here.

I'll upload the Thread1 subclassing example app where the IF logic fails over the weekend for you to have a look at if you are still interested?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: GPF when sending emails Pt4
« Reply #7 on: October 05, 2012, 03:25:06 AM »
sure, absolutely.