Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18584 > unrolled thread

Strange Delay in Page display (OT ??)

Started by"Mel Smith" <med_cutout_syntel@aol.com>
First post2013-02-21 11:31 -0700
Last post2013-02-25 16:41 -0700
Articles 8 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  Strange Delay in Page display (OT ??) "Mel Smith" <med_cutout_syntel@aol.com> - 2013-02-21 11:31 -0700
    Re: Strange Delay in Page display (OT ??) Danny <dann90038@gmail.com> - 2013-02-21 15:42 -0800
      Re: Strange Delay in Page display (OT ??) "Mel Smith" <med_cutout_syntel@aol.com> - 2013-02-21 17:57 -0700
        Re: Strange Delay in Page display (OT ??) "Mel Smith" <med_cutout_syntel@aol.com> - 2013-02-21 18:09 -0700
          Re: Strange Delay in Page display (OT ??) Richard Damon <Richard@Damon-Family.org> - 2013-02-24 20:37 -0500
            Re: Strange Delay in Page display (OT ??) "Mel Smith" <med_cutout_syntel@aol.com> - 2013-02-25 13:29 -0700
              Re: Strange Delay in Page display (OT ??) Christoph Becker <cmbecker69@gmx.de> - 2013-02-25 22:43 +0100
                Re: Strange Delay in Page display (OT ??) "Mel Smith" <med_cutout_syntel@aol.com> - 2013-02-25 16:41 -0700

#18584 — Strange Delay in Page display (OT ??)

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-02-21 11:31 -0700
SubjectStrange Delay in Page display (OT ??)
Message-ID<aon7faFo7deU1@mid.individual.net>
Hi:

    I have noted a delay of from 5 to 11 seconds in displaying a page sent 
from my server to a client (just *me* for now).

I have a very simple page with the following line:

    <body onload="setupflds();">

    etc,etc
    </body>

and the following JS

***********************
function setupflds() {

alert("I get here from 5 to 11 seconds *after* the display shows very 
quickly on the screen !") ;

var srcel=document.getElementById("huserid") ;
var dstel=document.getElementById("iuserid") ;
dstel.firstChild.nodeValue=" "+srcel.value ;

srcel=document.getElementById("hpassword") ;
dstel=document.getElementById("ipassword") ;
dstel.firstChild.nodeValue=" "+srcel.value ;

srcel=document.getElementById("hscrname") ;
dstel=document.getElementById("iscrname") ;
dstel.firstChild.nodeValue=" "+srcel.value ;
}
***************************

Environment:

    My user has just 'registered' at my site thru a series of pages, and I 
then (from my server CGI software) send the above page, and immediately (and 
programmatically) send a confirmatory email message to his email address.

    The user ( i.e., me) sees the page immediately, *but* the onload event 
does not fire for 5 to 11 seconds after the display is shown !

Question:
   Under what condition(s) does the 'onload' event fail to initiate its 
associated function immediately on the display of the page ?

    Or what is happening to delay the initiation of that function ?


Thanks for any insight into this problem.

-- 
Mel Smith

[toc] | [next] | [standalone]


#18588

FromDanny <dann90038@gmail.com>
Date2013-02-21 15:42 -0800
Message-ID<d1d0ecaf-e553-4c98-b3c8-0c14a9af8372@googlegroups.com>
In reply to#18584
To Mel Smith

the window.onload event fires up once things are loaded in Body, so it can't be that, has to be something else.

[toc] | [prev] | [next] | [standalone]


#18591

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-02-21 17:57 -0700
Message-ID<aonu3hFt8h4U1@mid.individual.net>
In reply to#18588
Danny said:

> the window.onload event fires up once things are loaded in Body, so it 
> can't be that, has to be something else.

Hi Danny:

    At the same time my page is 'served' (by my Apache Server on a PC beside 
me), my CGI app also sends me (the client) an email to an AOL account on my 
'client' / development machine, and also a BCC email to another gmail 
account on this same machine (which, for me,  acts as a monitor of 
registration actions).

    So,

    When my page is being displayed in front of me, at the same time I have 
two emails being generated by the server and sent to me programmatically.

Q:   Could the near simultaneous arrival of these emails along with the 
display of the page somehow *delay* the action of the 'onload' function in 
some way ???

(btw, my development machine (and test client) is a Win XP Pro machine and I 
receive emails on AOL and GMAIL)

I guess I can test this out by bypassing my email sender, and I'll do that 
tonite)

Thanks,

-Mel


[toc] | [prev] | [next] | [standalone]


#18594

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-02-21 18:09 -0700
Message-ID<aonuqaFtcusU1@mid.individual.net>
In reply to#18591
I said:

>
> Hi Danny:
>
>    At the same time my page is 'served' (by my Apache Server on a PC 
> beside me), my CGI app also sends me (the client) an email to an AOL 
> account on my 'client' / development machine, and also a BCC email to 
> another gmail account on this same machine (which, for me,  acts as a 
> monitor of registration actions).
>
>    So,
>
>    When my page is being displayed in front of me, at the same time I have 
> two emails being generated by the server and sent to me programmatically.
>
> Q:   Could the near simultaneous arrival of these emails along with the 
> display of the page somehow *delay* the action of the 'onload' function in 
> some way ???
>
> (btw, my development machine (and test client) is a Win XP Pro machine and 
> I receive emails on AOL and GMAIL)
>
> I guess I can test this out by bypassing my email sender, and I'll do that 
> tonite)


Hi Danny:

    I just tried it -- with and without my server sending the email to the 
client:

Result:  The sending of the email 'somehow' slows down my client machine 
while the email software on the server is doing *something* with my client 
machine to slow it down ???

    I'll talk with the developers and see what this is, and what I can do to 
prevent the email software from interfering with the operation of the 
client.

Thank you.

-Mel Smith

[toc] | [prev] | [next] | [standalone]


#18620

FromRichard Damon <Richard@Damon-Family.org>
Date2013-02-24 20:37 -0500
Message-ID<ufzWs.14885$Zp1.6558@en-nntp-15.dc1.easynews.com>
In reply to#18594
On 2/21/13 8:09 PM, Mel Smith wrote:
> I said:
> 
>>
>> Hi Danny:
>>
>>    At the same time my page is 'served' (by my Apache Server on a PC 
>> beside me), my CGI app also sends me (the client) an email to an AOL 
>> account on my 'client' / development machine, and also a BCC email to 
>> another gmail account on this same machine (which, for me,  acts as a 
>> monitor of registration actions).
>>
>>    So,
>>
>>    When my page is being displayed in front of me, at the same time I have 
>> two emails being generated by the server and sent to me programmatically.
>>
>> Q:   Could the near simultaneous arrival of these emails along with the 
>> display of the page somehow *delay* the action of the 'onload' function in 
>> some way ???
>>
>> (btw, my development machine (and test client) is a Win XP Pro machine and 
>> I receive emails on AOL and GMAIL)
>>
>> I guess I can test this out by bypassing my email sender, and I'll do that 
>> tonite)
> 
> 
> Hi Danny:
> 
>     I just tried it -- with and without my server sending the email to the 
> client:
> 
> Result:  The sending of the email 'somehow' slows down my client machine 
> while the email software on the server is doing *something* with my client 
> machine to slow it down ???
> 
>     I'll talk with the developers and see what this is, and what I can do to 
> prevent the email software from interfering with the operation of the 
> client.
> 
> Thank you.
> 
> -Mel Smith
> 
> 
It could be that the server doesn't send the very last of the page to
the browser until the after sending the email. Perhaps forcing a flush
of the buffer before doing the email send.

onload can not happen until the page IS fully loaded, but many browsers
will work on rendering a partial page, so if the closing page tags are
delayed then that would delay the onload, but possibly not the page display.

[toc] | [prev] | [next] | [standalone]


#18629

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-02-25 13:29 -0700
Message-ID<ap1vtuF4pd1U1@mid.individual.net>
In reply to#18620
Richard said:

">>
> It could be that the server doesn't send the very last of the page to
> the browser until the after sending the email. Perhaps forcing a flush
> of the buffer before doing the email send.
>
> onload can not happen until the page IS fully loaded, but many browsers
> will work on rendering a partial page, so if the closing page tags are
> delayed then that would delay the onload, but possibly not the page 
> display.

Hi Richard:

    So, I guess that *sending* both emails by my sendmail() function in my 
server somehow either ties up my CGI app, or ties up my Apache server 
software, and slows one or both down until my sendmail() function is 
completed.

    I'll have to find a way to somehow lower the priority of the sendmail so 
it doesn't slow things down.

Thanks for the comment.

-Mel

[toc] | [prev] | [next] | [standalone]


#18630

FromChristoph Becker <cmbecker69@gmx.de>
Date2013-02-25 22:43 +0100
Message-ID<kggls7$k5d$1@speranza.aioe.org>
In reply to#18629
Mel Smith wrote:

>     So, I guess that *sending* both emails by my sendmail() function in my 
> server somehow either ties up my CGI app, or ties up my Apache server 
> software, and slows one or both down until my sendmail() function is 
> completed.
>
>    I'll have to find a way to somehow lower the priority of the
> sendmail so it doesn't slow things down.

I suppose that your sendmail() function works synchronously.  If so, the
script will only continue after the mail was sent, and lowering the
process priority of sendmail will only slow things down more.

You might consider to call setupflds() directly after all the respective
elements were sent to the browser (flushing the buffer is reasonable, as
Richard wrote), but before you call sendmail().

A simplified example in a fictious language:

  print '<input id="hscrname" ...>'
  print '<input id="iscrname" ...>'
  print '<script type="text/javascript">setupflds()</script>'
  flush
  sendmail()

Of course this won't fit with a clean separation of model and view, so
another possibility might be to send the mail asynchronously, e.g. by
writing it to a queue which will be processed independently.

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#18631

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-02-25 16:41 -0700
Message-ID<ap2b56F7atjU1@mid.individual.net>
In reply to#18630
Christoph said:

> Of course this won't fit with a clean separation of model and view, so
> another possibility might be to send the mail asynchronously, e.g. by
> writing it to a queue which will be processed independently.
>

Hi Christoph:

    Below is the short section where I read in  the form template, then 
fill-it in, then send it to Apache for frorwarding to my Apache server.

    Then, I send info down two levels to my Mail Sender to start the set up 
and delivering of the mail

    ***************************************************
      cFORM :=MEMOREAD(cREGCPLT)    // Read-in the form template

      // now replace holding fields with actual user data
      cFORM := STRTRAN(cFORM,"#uuserid#",cUSERID)
      cFORM := STRTRAN(cFORM,"#upassword#",cPASSWORD)
      cFORM := STRTRAN(cFORM,"#uscrname#",cSCREENNAME)
      cFORM := STRTRAN(cFORM,"#uemail#",cEMAIL) // but don't show this on 
his display

      CGIOUT cFORM      // send the form to Apache for onward transmission 
to the user

      // Now go and send the confirming email to the person who registered
      lMAILSENT := REGEMAIL(cUSERID,cUKEY,cPASSWORD,cSCREENNAME,cEMAIL)  // 
two levels down is the actual hb_sendmail() function

      IF .NOT. lMAILSENT
         ERRLOG("Fail Send Email :" + cUSERID + " at " + cEMAIL)
      ENDIF
      CLOSE DATABASES

      RETURN NIL     // and release this thread

********************************************

    Instead, as you mentioned, I could set up an asynchronous process to 
send the email.  This is easy for me to do, and I will consider doing it 
(i.e., starting up another 'process' to run the hb_sendmail().  I can also 
change the 'timeout' period I give the function to 'test' the response I get 
from the user's email provider.

Thanks for the alternate suggestion. I'll try it.

--
Mel Smith


[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web