Project

General

Profile

Actions

Support #5958

closed

pressing refresh (F5) continuously, sessions are not always destroyed

Added by Alessandro Giuliani over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
09/28/2017
Due date:
% Done:

0%

Estimated time:

Description

Hello,

I need to delete an object on session closing so I put the object delete on destroy() function and then I refresh Chrome view, pressing F5. Sometimes the session is properly destroyed so the destroy() method of my wtapplication gets called, the more often the old application locks in exec() method and the destroy() is never called.The consequence is also that threads number continuously increases and the memory is not released (leak).

I am using WT 3.3.7.

Thanks in advance, best regards

Alex

Actions #1

Updated by Alessandro Giuliani over 6 years ago

Hello,

the issue can tested using "hello" wt example , overriding the finalize() method of HelloApplication class..

void HelloApplication::finalize()

{

qDebug() << "\n* finalized!";

WApplication::finalize();

}

Launching the app and pressing continuously F5 button on the browser we have the following output..

[.....]

[2017-Sep-29 09:32:11.955410] 3102 [/ bRrCcVwJeIj8LREZ] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36"

[2017-Sep-29 09:32:11.955872] 3102 - [info] "WebRequest: took 0.619ms"

[2017-Sep-29 09:32:11.959097] 3102 - [info] "WebController: Removing session V7H23o2ENQiHhRU9"

  • finalized!

    [2017-Sep-29 09:32:11.959227] 3102 - [info] "WebRequest: took 0.264ms"

    [2017-Sep-29 09:32:11.959254] 3102 [/ V7H23o2ENQiHhRU9] [info] "Wt: session destroyed (#sessions = 6)"

    [2017-Sep-29 09:32:11.967483] 3102 - [info] "WebRequest: took 4.381ms"

    [2017-Sep-29 09:32:11.973842] 3102 - [info] "WebRequest: took 6.889ms"

    [2017-Sep-29 09:32:12.049138] 3102 - [info] "WebRequest: took 0.373ms"

    [2017-Sep-29 09:32:12.131777] 3102 - [info] "Wt: session created (#sessions = 7)"

    [2017-Sep-29 09:32:12.131869] 3102 [/ FHR4rARIKms6OS6C] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36"

    [2017-Sep-29 09:32:12.132302] 3102 - [info] "WebRequest: took 0.613ms"

    [2017-Sep-29 09:32:12.148939] 3102 - [info] "WebRequest: took 5.731ms"

    [2017-Sep-29 09:32:12.154860] 3102 - [info] "WebRequest: took 6.415ms"

    [2017-Sep-29 09:32:12.228052] 3102 - [info] "WebRequest: took 0.339ms"

    [2017-Sep-29 09:32:12.307153] 3102 - [info] "Wt: session created (#sessions = 8)"

    [2017-Sep-29 09:32:12.307236] 3102 [/ XdFpuGX9zdIrN87v] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36"

    [2017-Sep-29 09:32:12.307586] 3102 - [info] "WebRequest: took 0.534ms"

    [2017-Sep-29 09:32:12.319116] 3102 - [info] "WebRequest: took 5.228ms"

    [2017-Sep-29 09:32:12.323159] 3102 - [info] "WebRequest: took 5.255ms"

    [2017-Sep-29 09:32:12.405472] 3102 - [info] "WebRequest: took 0.305ms"

    [2017-Sep-29 09:32:12.483428] 3102 - [info] "Wt: session created (#sessions = 9)"

    [2017-Sep-29 09:32:12.483567] 3102 [/ 1FGY3pDm7Q7WxgC7] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36"

    [2017-Sep-29 09:32:12.484042] 3102 - [info] "WebRequest: took 0.7ms"

    [2017-Sep-29 09:32:12.487464] 3102 - [info] "WebController: Removing session XdFpuGX9zdIrN87v"

  • finalized!

    [2017-Sep-29 09:32:12.487588] 3102 [/ XdFpuGX9zdIrN87v] [info] "Wt: session destroyed (#sessions = 8)"

[.....]

Actions #2

Updated by Alessandro Giuliani over 6 years ago

Hello, I just discovered the following:

- closing browser tab always bring to session destroy, so the problem is only related to refresh (F5)

  • using Firefox browser the refresh always bring to session destroy..

  • finalized!

    [2017-Sep-29 09:59:52.712575] 3657 [/ vgvxWFkmEENSYsrR] [info] "Wt: session destroyed (#sessions = 1)"

    [2017-Sep-29 09:59:52.712709] 3657 - [info] "WebRequest: took 0.417ms"

    [2017-Sep-29 09:59:52.741207] 3657 - [info] "WebRequest: took 13.904ms"

    [2017-Sep-29 09:59:52.746531] 3657 - [info] "WebRequest: took 5.997ms"

    [2017-Sep-29 09:59:52.830319] 3657 - [info] "WebRequest: took 0.34ms"

    [2017-Sep-29 09:59:53.239587] 3657 - [info] "Wt: session created (#sessions = 2)"

    [2017-Sep-29 09:59:53.239698] 3657 [/ TXSGMq7PfZhPPS4P] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"

    [2017-Sep-29 09:59:53.240103] 3657 - [info] "WebRequest: took 0.615ms"

    [2017-Sep-29 09:59:53.249466] 3657 - [info] "WebController: Removing session c2suDfoY9fp6JfIV"

  • finalized!

    [2017-Sep-29 09:59:53.249596] 3657 - [info] "WebRequest: took 0.305ms"

    [2017-Sep-29 09:59:53.249612] 3657 [/ c2suDfoY9fp6JfIV] [info] "Wt: session destroyed (#sessions = 1)"

    [2017-Sep-29 09:59:53.277932] 3657 - [info] "WebRequest: took 16.226ms"

    [2017-Sep-29 09:59:53.282461] 3657 - [info] "WebRequest: took 5.087ms"

    [2017-Sep-29 09:59:53.365372] 3657 - [info] "WebRequest: took 0.3ms"

    [2017-Sep-29 09:59:53.735415] 3657 - [info] "Wt: session created (#sessions = 2)"

    [2017-Sep-29 09:59:53.735511] 3657 [/ jOaso1fdvjng1Obd] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"

    [2017-Sep-29 09:59:53.736001] 3657 - [info] "WebRequest: took 0.654ms"

    [2017-Sep-29 09:59:53.744561] 3657 - [info] "WebController: Removing session TXSGMq7PfZhPPS4P"

  • finalized!

    [2017-Sep-29 09:59:53.744731] 3657 [/ TXSGMq7PfZhPPS4P] [info] "Wt: session destroyed (#sessions = 1)"

    [2017-Sep-29 09:59:53.744745] 3657 - [info] "WebRequest: took 0.35ms"

    [2017-Sep-29 09:59:53.772064] 3657 - [info] "WebRequest: took 15.434ms"

    [2017-Sep-29 09:59:53.777015] 3657 - [info] "WebRequest: took 5.546ms"

    [2017-Sep-29 09:59:53.859969] 3657 - [info] "WebRequest: took 0.205ms"

    [2017-Sep-29 10:00:06.929114] 3657 - [info] "Wt: session created (#sessions = 2)"

    [2017-Sep-29 10:00:06.929216] 3657 [/ H1fAsDVtM3cl6jOV] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"

    [2017-Sep-29 10:00:06.929609] 3657 - [info] "WebRequest: took 0.58ms"

    [2017-Sep-29 10:00:06.941408] 3657 - [info] "WebController: Removing session jOaso1fdvjng1Obd"

..so this problem is only related to Chrome refresh management.

Solution ( Workaround ) : Set wt_config.xml "reload-is-new-session" entry to FALSE. In this way refresh never creates new sessions and closing the tab removes also the related session avoiding leaks.

Actions #3

Updated by Wim Dumon over 6 years ago

  • Status changed from New to Feedback

That is of course side-stepping the issue :)

The answer should be that it's impossible to guarantee that the server is informed immediately about a client no longer being there (disconnected, bad internet connection, because of reload, or because the browser window was closed). Wt cleans up these sessions by sending pings and killing them after a timeout period. Eventually, all unused sessions should be cleaned up, if not that is a bug in Wt.

Btw, is this Wt or JWt?

Best regards,

Wim.

Actions #4

Updated by Alessandro Giuliani over 6 years ago

Hi Wim,

I am using WT 3.3.7

Yes, this is not the solution however if you want to test and discover if it is a bug, the way is quite simple. Use Chrome and try to refresh (F5) on the "hello" example. The thread number increases. In our case this was not the only problem: we would like to destroy a tcp connection on session closure but the finalize() function were not called properly. Now (using workaround) our problem is solved. I wrote my workaround to share these info.

Regards,

Alex

Actions #5

Updated by Roel Standaert over 6 years ago

  • Status changed from Feedback to Closed

I've checked just to be sure, and it's working as intended. Like Wim said, we can't guarantee that the server is immediately informed about a client being no longer there. If you want the server to cleanup the session faster you need to reduce the session timeout parameter, which is set to 10 minutes (600 seconds) by default.

The only downside to reducing this timeout is that the chance of inadvertently quitting a session (e.g. due to connectivity problems) increases, and there's a little bit more communication between client and server because of keep-alives. It's up to you to choose the timeout that is appropriate for your application.

Regards,

Roel

Actions #6

Updated by Alessandro Giuliani over 6 years ago

Thanks Roel!

:)

Actions

Also available in: Atom PDF