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

Uncaught Error: Expecting promise in table. 0 #2033

Closed
keroxp opened this issue Apr 1, 2019 · 2 comments
Closed

Uncaught Error: Expecting promise in table. 0 #2033

keroxp opened this issue Apr 1, 2019 · 2 comments

Comments

@keroxp
Copy link
Contributor

keroxp commented Apr 1, 2019

env

  • OS: macOS 10.14.3
  • deno: v0.3.5

description

$ deno -A https://deno.land/std/http/http_bench.ts
$ wrk -t12 -c400 -d30s http:https://127.0.0.1:4500

got

Uncaught Error: Expecting promise in table. 0
    at assert (js/util.ts:28:11)
    at handleAsyncMsgFromRust (js/dispatch.ts:16:3)
    at handleAsyncMsgFromRust (shared_queue.js:117:9)

cmdId on here get 0. I tried to set let nextCmdId = 1 and got the same error. Maybe handleAsyncMsgFromRust had been called with invalid argument.

@kevinkassimo
Copy link
Contributor

kevinkassimo commented Apr 2, 2019

When printing out innerType of this msg received, I got 0 (aka msg.Any.NONE) which should never have happened if fired by any well-defined defined op... Something might have gone terribly wrong

Highly suspecting it related with the shifting logic of shared_queue. The content of the very last message that triggers cmdId == 0 looks completely different with any other normal messages.

e.g. for buf passed to handleAsyncMsgFromRust that got shifted out of shared_queue:

Uint8Array [ 20, 0, 0, 0, 16, 0, 18, 0, 8, 0, 0, 0, 0, 0, 0, 0, 7, 0, 12, 0, 16, 0, 0, 0, 0, 0, 0, 30, 254, 0, 0, 0, 12, 0, 0, 0, 0, 0, 6, 0, 8, 0, 4, 0, 6, 0, 0, 0, 130, 0, 0, 0 ]
gives cmdId 254 [0*256 + 254]

Uint8Array [ 20, 0, 0, 0, 16, 0, 18, 0, 8, 0, 0, 0, 0, 0, 0, 0, 7, 0, 12, 0, 16, 0, 0, 0, 0, 0, 0, 30, 0, 1, 0, 0, 12, 0, 0, 0, 0, 0, 6, 0, 8, 0, 4, 0, 6, 0, 0, 0, 131, 0, 0, 0 ]
gives cmdId 256 [1*256 + 0]

Uint8Array [ 20, 0, 0, 0, 16, 0, 18, 0, 8, 0, 0, 0, 0, 0, 0, 0, 7, 0, 12, 0, 16, 0, 0, 0, 0, 0, 0, 30, 2, 1, 0, 0, 12, 0, 0, 0, 0, 0, 6, 0, 8, 0, 4, 0, 6, 0, 0, 0, 132, 0, 0, 0 ]
gives cmdId 258 [1*256 + 2]

Uint8Array [ 32, 22, 0, 0, 84, 22, 0, 0, 136, 22, 0, 0, 188, 22, 0, 0, 240, 22, 0, 0, 36, 23, 0, 0, 88, 23, 0, 0, 140, 23, 0, 0, 192, 23, 0, 0, 244, 23, 0, 0, 40, 24, 0, 0, 92, 24, 0, 0, 144, 24, 0, 0 ]
gives cmdId 0 [probably flatbuffers serialize error]

Will try investigate the actual flatbuffers layout logic tomorrow to see what is going on.

@orsi
Copy link
Contributor

orsi commented Apr 2, 2019

I've been poking into the typescript api with flatbuffers. Not sure if I understand enough of it yet to give any feedback, but it seems like some of the flatbuffers created in the api are missing some fields.

E.g. https://github.com/denoland/deno/blob/master/js/fetch.ts#L327
The generated msg.HttpHeader in "gen/cli/msg_generated" has a createHttpHeader() function which seems to add a status field that isn't included here.

Could this be shifting some of the buffers around? A few of the other ts apis with flatbuffers also seem to miss adding some fields.

keroxp added a commit to keroxp/deno that referenced this issue Apr 20, 2019
ry added a commit to ry/deno that referenced this issue Apr 20, 2019
ry pushed a commit to ry/deno that referenced this issue Apr 20, 2019
@ry ry closed this as completed in 961f87e Apr 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants