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

[Canvas] Fix: avoid server crash when no value is found #29069

Merged
merged 1 commit into from
Jan 22, 2019

Conversation

monfera
Copy link
Contributor

@monfera monfera commented Jan 21, 2019

Summary

Closes #29035

@monfera monfera added the Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas label Jan 21, 2019
@monfera monfera self-assigned this Jan 21, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@monfera monfera changed the title [Canvas][WIP] Fix: avoid server crash when no value is found [Canvas] Fix: avoid server crash when no value is found Jan 21, 2019
@monfera monfera added the review label Jan 21, 2019
worker.send({ type: 'msgSuccess', id, value: value });
})
.catch(e => heap[threadId].reject(e));
if (heap[threadId]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is it possible that the heap[threadId] does not exist ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully grok it at the moment, as mentioned in chat I'd like to learn more about the heap concept here, will reach out to @w33ble who's most familiar with the code.

The error was caused by acting on an object that isn't in this lookup table, so it's safe to avoid that and with that, the server crash.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This came up in one of Peter's PRs too, but he thought at the time it was related to some other change. I think @chrisdavies did an awesome job explaining what happens in this comment

What's happening is that worker.js is getting lots of calls to onFunctionNotFound, each with the same threadId, but with different params

This happens because something like mapColumn will map over every row, as you can see in the example Stacey provided in the original issue

Once the first one fails, the threadId is removed from the heap in thread/index.js, so the subsequent calls fail to find any heap context for that threadId.

And that's why it was blowing up. In Stacey's example, she was using doesntexist (an invalid function) as the function to run in mapColumn. That rejects, clears the heap, and subsequent heap actions blow up because the id is no longer valid.

@ppisljar ppisljar requested a review from w33ble January 22, 2019 04:35
Copy link
Contributor

@chrisdavies chrisdavies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This does fix the Node crash, but as mentioned, it's a stop-gap until we can figure out how it's happening. I have several hunches that I'm going to look into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v6.6.1 v6.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants