Framework: Duplicate resource warning using push

Created on 25 Sep 2015  路  22Comments  路  Source: vaadin/framework

Originally by _ssc_user_


Description

We are developing a web application which is using push to notify the user of updated data. That works well, but when we looked at our logs, we noticed that occasionally there are a lot of duplicate resource warnings like this:

2015-08-26 14:04:36,018 WARN 3520 --- [p2050191895-200] org.atmosphere.cpr.DefaultBroadcaster : Duplicate resource 7cd4925e-82de-42fb-b2df-254bf6b60c8e. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one 

How to reproduce

This is probably not the only way to make these warnings occur.
I'm using Java version 8 update 60, Firefox 41.0 and Tomcat 8.0.26.[[BR]]

  1. Create a vaadin project and create the code for a site, that uses websockets push or use your existing project, if it uses push with websockets.
    (I made a fresh vaadin project, modified the Ui class according to http://stackoverflow.com/questions/27808460/minimal-example-of-push-in-vaadin-7-app-push and modified the web.xml file so that I could use websockets. The java and the web.xml files are attached.)
  2. Open the Firefox and navigate to a site of your web app that uses push.
  3. Press 'Alt' to access the menu bar of Firefox. Navigate to File > Work Offline and enable it to activate the offline mode.
  4. Reload the page.
  5. Repeat step 3 to disable the offline mode.

After disabling the offline Mode, the server console immediately starts to get spammed with the warning about once every second. A console log is attached.

Cause

After debugging both the server and client side, I think that the problem is caused at the client side (in the vaadinPush[.debug].js), because it is only designed for one websocket at a time (on global _websocket variable). It gets messed up, if a second websocket is created while the first one is still active:[[BR]]

The warning is caused by the client, which is for some reason trying to create a second websocket connection to the server. The server logs the warning, closes the (still valid) old connection and accepts the new connection.
The client side recognizes that the old connection is closed and executes its onclose callback _websocket.onclose (at vaadinPush.debug.js:11690)).
This callback tries to reconnect the websocket. But before it does that, it calls _clearState (at vaadinPush.debug.js:11748) which calls _websocket.onclose.

The problem is, that _websocket does not reference the websocket whose onClose callback is executing. Instead it closes the other websocket, which causes its onClose callback to also get executed.[[BR]]

However, the second onClose does not cancel the first websocket connection, because it is not yet connected.
To reconnect, the websockets use setTimeout(func, timespan) ([https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout]) (at vaadinPush.debug.js:11752), which delays the reconnection.
After the delay, the first websocket reconnects successfully, but then the second websocket tries to connect and the process starts again.

Without websocket

The above describes the situation when communication via a websocket is available. But the warnings also appear if you do the steps described above and only long-polling is available. It is worth mentioning that with long polling, the number of warnings per second increases, because no delay seems to exists when reconnecting.


Imported from https://dev.vaadin.com/ issue #19008

bug Stale

Most helpful comment

Following up again since it's been a month and no response. Are there are any updates on this issue?

All 22 comments

Originally by _ssc_user_


Attachment added: VaadinPushTest.java (1.1 KiB)
The Java class to reproduce the issue

Originally by _ssc_user_


Attachment added: web.xml (0.9 KiB)
The web.xml file to use in the test setup

Originally by _ssc_user_


Attachment added: server-console-log-push_using_websocket.txt (16.5 KiB)
Server log when using websockets

Originally by _ssc_user_


Attachment added: client-console-log-push_using_websocket.txt (25.9 KiB)
client log when using websockets

Originally by _ssc_user_


Attachment added: server-side-events.txt (1.2 KiB)
Events on the server side

Originally by _ssc_user_


Attachment added: server-console-log-push_using_long-polling.txt (21.1 KiB)
server log when using long polling

Originally by _ssc_user_


Attachment added: client-console-log-push_using_long-polling.txt (19.7 KiB)
client log when using long polling

Originally by @jdahlstrom


A big thank you for the detailed and well researched report! We'll take a look at this.

Originally by @Artur-


This should be re-tested with 7.6 beta2 or newer as a similar issue was fixed there

Have this message riddled through my logs, any progress?

I'm following up as well to see if there's any progress because I'm seeing several of these in my logs too...

Following up again since it's been a month and no response. Are there are any updates on this issue?

Any news folks? My logs are flooded with this messagens.

Which Vaadin Framework version you're running when you get these messages? Which servlet container?

We have a same issue as it is described here. We're using Vaadin 7.7.13 and Tomcat 8.0.16, 8.0.20, 9.0.5. Application is configured with PushMode.MANUAL and Transport.WEBSOCKET_XHR. Altought I'm not doing anything with the app, I can see in Tomcat log above mentioned "duplicate resource .... " message.

This warning message rises almost precisly every 5 minutes.

I believe I may have figured out the solution. Are you running "mvn clean" before building? For whatever reason even if I run the mvn package, etc., if I don't run clean manually first it seems to include older versions of the Vaadin jars in the war file. When I started doing this manually I haven't seen any further instances of this in my logs.

any updates in this issue?

Hello there!

We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

  • Check if the issue is still valid for the latest version. There are dozens of duplicates in our issue tracker, so it is possible that the issue is already tackled. If it appears to be fixed, close the issue, otherwise report to the issue that it is still valid.
  • Provide more details how to reproduce the issue.
  • Explain why it is important to get this issue fixed and politely draw others attention to it e.g. via the forum or social media.
  • Add a reduced test case about the issue, so it is easier for somebody to start working on a solution.
  • Try fixing the issue yourself and create a pull request that contains the test case and/or a fix for it. Handling the pull requests is the top priority for the core team.
  • If the issue is clearly a bug, use the Warranty in your Vaadin subscription to raise its priority.

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

Any news about this problem guys? I'm facing with Vaadin 7.7.13 (migrating), and 8.7.1, with Tomcat 8.5.38.

This problem occours hundred of times per hour:

Mar 13, 2019 5:44:11 PM org.atmosphere.cpr.DefaultBroadcaster addAtmosphereResource
WARNING: Duplicate resource 58d6e6fc-1e89-4360-845b-d1b4088fa0e6. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
Mar 13, 2019 5:44:15 PM org.atmosphere.cpr.DefaultBroadcaster addAtmosphereResource
WARNING: Duplicate resource 58d6e6fc-1e89-4360-845b-d1b4088fa0e6. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
Mar 13, 2019 5:44:19 PM org.atmosphere.cpr.DefaultBroadcaster addAtmosphereResource
WARNING: Duplicate resource 58d6e6fc-1e89-4360-845b-d1b4088fa0e6. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
Mar 13, 2019 5:44:23 PM org.atmosphere.cpr.DefaultBroadcaster addAtmosphereResource
WARNING: Duplicate resource 58d6e6fc-1e89-4360-845b-d1b4088fa0e6. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
Mar 13, 2019 5:44:27 PM org.atmosphere.cpr.DefaultBroadcaster addAtmosphereResource
WARNING: Duplicate resource 58d6e6fc-1e89-4360-845b-d1b4088fa0e6. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
Mar 13, 2019 5:44:32 PM org.atmosphere.cpr.DefaultBroadcaster addAtmosphereResource
WARNING: Duplicate resource 58d6e6fc-1e89-4360-845b-d1b4088fa0e6. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
Mar 13, 2019 5:44:36 PM org.atmosphere.cpr.DefaultBroadcaster addAtmosphereResource
WARNING: Duplicate resource 58d6e6fc-1e89-4360-845b-d1b4088fa0e6. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
Mar 13, 2019 5:44:40 PM org.atmosphere.cpr.DefaultBroadcaster addAtmosphereResource
WARNING: Duplicate resource 58d6e6fc-1e89-4360-845b-d1b4088fa0e6. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one

Hello there!

We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

  • Check if the issue is still valid for the latest version. There are dozens of duplicates in our issue tracker, so it is possible that the issue is already tackled. If it appears to be fixed, close the issue, otherwise report to the issue that it is still valid.
  • Provide more details how to reproduce the issue.
  • Explain why it is important to get this issue fixed and politely draw others attention to it e.g. via the forum or social media.
  • Add a reduced test case about the issue, so it is easier for somebody to start working on a solution.
  • Try fixing the issue yourself and create a pull request that contains the test case and/or a fix for it. Handling the pull requests is the top priority for the core team.
  • If the issue is clearly a bug, use the Warranty in your Vaadin subscription to raise its priority.

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

If you are using Vaadin 8, you should test if Vaadin 8.11.alpha1 fixes the situation due this fix https://github.com/vaadin/framework/pull/11884 ?

Hello there!

We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

  • Check if the issue is still valid for the latest version. There are dozens of duplicates in our issue tracker, so it is possible that the issue is already tackled. If it appears to be fixed, close the issue, otherwise report to the issue that it is still valid.
  • Provide more details how to reproduce the issue.
  • Explain why it is important to get this issue fixed and politely draw others attention to it e.g. via the forum or social media.
  • Add a reduced test case about the issue, so it is easier for somebody to start working on a solution.
  • Try fixing the issue yourself and create a pull request that contains the test case and/or a fix for it. Handling the pull requests is the top priority for the core team.
  • If the issue is clearly a bug, use the Warranty in your Vaadin subscription to raise its priority.

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vaadin-bot picture vaadin-bot  路  6Comments

FSchliephacke picture FSchliephacke  路  4Comments

RobertZenz picture RobertZenz  路  6Comments

tomislavi picture tomislavi  路  6Comments

vaadin-bot picture vaadin-bot  路  7Comments