Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket messages are being dropped #131

Closed
go-oleg opened this issue Feb 1, 2016 · 3 comments
Closed

websocket messages are being dropped #131

go-oleg opened this issue Feb 1, 2016 · 3 comments
Labels

Comments

@go-oleg
Copy link
Collaborator

go-oleg commented Feb 1, 2016

There have been some reports of outrigger not showing all the points coming out of a juttle program.

A program to reproduce this:

read file -file 'dense.json' -to :2014-01-01T00:59:59:
| keep value1, time
| view timechart -valueField 'value1'

The json file (needs to be renamed to .json): dense.txt

If you run this program, you will get a timechart with the following time range:
image

According to the data, the time should actually go up to 00:59:59.

In debugging this, i tried adding the following right after this line:

console.log(msg.type);

What I saw was a bit puzzling:
image

In the screenshot, there are 8 messages with type: "points" but in the console, "points" is only printed 6 times. Additionally, the "sink_end" and "job_end" messages are never printed. So the browser is certainly receiving them according to chrome dev tools, but somehow our WebSocket onmessage event listener isn't seeing them before it gets the onclose event.

Wondering if waiting longer in outrigger to close the websocket would make the problem go away, I tried adding a 1 second setTimeout on this line before actually closing the websocket. Sure enough, I started seeing all the messages:
image
And as expected the timechart shows the full range:
image

So...a bit uncertain as to what is going on. Is outrigger closing the websocket too soon? Should we be sending back acknowledgements from the browser? The browser certainly seems to be receiving the messages, just not our WebSocket onmessage handler.

@mnibecker @mstemm, you guys have dealt with some race conditions related to websockets in outrigger/juttle-client-library...any thoughts on what could be going on here?

@go-oleg go-oleg added the bug label Feb 1, 2016
@mstemm mstemm self-assigned this Feb 3, 2016
@mstemm
Copy link
Collaborator

mstemm commented Feb 3, 2016

We decided that the best + easiest workaround is to actually close the websocket connection from the server side after a short delay. That should give the browser enough time to actually read + process all datapoints before the connection close causes it to lose the final points.

@mstemm
Copy link
Collaborator

mstemm commented Feb 3, 2016

Filed juttle/juttle-service#9 to track fixing this in juttle-engine.

mstemm pushed a commit that referenced this issue Feb 4, 2016
This is a fix for #131, taking parts of the fix from juttle-engine for
juttle/juttle-engine#9. I didn't bother with a fully configurable timeout.

I did copy over a unit test to ensure that there is a delay between
the job_end message and the websocket being closed.
@mstemm mstemm added ready and removed in progress labels Feb 9, 2016
@mstemm mstemm removed their assignment Feb 9, 2016
@mstemm
Copy link
Collaborator

mstemm commented Feb 9, 2016

Un-assigning this from myself as it's for the old product.

@mstemm mstemm closed this as completed Feb 23, 2016
@mstemm mstemm removed the ready label Feb 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants