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

UnhandledPromiseRejectionWarning: Error: BUFFER_SHORTAGE #2337

Open
thelindat opened this issue Jan 11, 2024 · 4 comments
Open

UnhandledPromiseRejectionWarning: Error: BUFFER_SHORTAGE #2337

thelindat opened this issue Jan 11, 2024 · 4 comments
Labels
bug ScRT: JS Issues/PRs related to the JavaScript scripting runtime triage Needs a preliminary assessment to determine the urgency and required action

Comments

@thelindat
Copy link
Contributor

What happened?

Calling an async export when a script is stopping leads to the following error.

(node:8880) UnhandledPromiseRejectionWarning: Error: BUFFER_SHORTAGE
    at n.e [as reserve] (citizen:/scripting/v8/msgpack.js:29:12766)
    at h (citizen:/scripting/v8/msgpack.js:29:15761)
    at n.r [as decode] (citizen:/scripting/v8/msgpack.js:29:13908)
    at n.fetch (citizen:/scripting/v8/msgpack.js:29:6972)
    at n.u [as read] (citizen:/scripting/v8/msgpack.js:29:12076)
    at Object.n [as decode] (citizen:/scripting/v8/msgpack.js:29:7097)
    at unpack (citizen:/scripting/v8/main.js:50:33)
    at citizen:/scripting/v8/main.js:82:21
    at Number.__cfx_wrap_38 (citizen:/scripting/v8/main.js:23:12)
    at citizen:/scripting/v8/main.js:29:16
(Use `FXServer --trace-warnings ...` to show where the warning was created)
ba(node:8880) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

Expected result

Either discard the error or give a more sensible message.

Reproduction steps

  1. Create an async export in a resource using the v8 scrt (resource A).
  2. Add an event handler in another resource (resource B), listening for onResourceStop.
  3. Call the export from resource B.
  4. When resource A tries to return to the invoking resource, msgpack throws the error above.

Importancy

Slight inconvenience

Area(s)

ScRT: JS

Specific version(s)

Server 7290

Additional information

Using a try-catch block here will catch the error, but I'm unsure if it's indicative of issue elsewhere.

https://github.com/citizenfx/fivem/blob/master/data/shared/citizen/scripting/v8/main.js#L29

@thelindat thelindat added bug triage Needs a preliminary assessment to determine the urgency and required action labels Jan 11, 2024
@github-actions github-actions bot added the ScRT: JS Issues/PRs related to the JavaScript scripting runtime label Jan 11, 2024
@TeKGameR950
Copy link

Yeah, facing the same issue, have you found any issue ? i'm personally using oxmysql, and when doing an sql request onRessourceStop i'm having the same issue.

[ STDERR] (node:11056) UnhandledPromiseRejectionWarning: Error: BUFFER_SHORTAGE
[ STDERR] at n.e [as reserve] (citizen:/scripting/v8/msgpack.js:29:12766)
[ STDERR] at h (citizen:/scripting/v8/msgpack.js:29:15761)
[ STDERR] at n.r [as decode] (citizen:/scripting/v8/msgpack.js:29:13908)
[ STDERR] at n.fetch (citizen:/scripting/v8/msgpack.js:29:6972)
[ STDERR] at n.u [as read] (citizen:/scripting/v8/msgpack.js:29:12076)
[ STDERR] at Object.n [as decode] (citizen:/scripting/v8/msgpack.js:29:7097)
[ STDERR] at unpack (citizen:/scripting/v8/main.js:50:33)
[ STDERR] at citizen:/scripting/v8/main.js:82:21
[ STDERR] at Number.__cfx_wrap_19703 (citizen:/scripting/v8/main.js:23:12)
[ STDERR] at citizen:/scripting/v8/main.js:29:16
[ STDERR] (node:11056) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 15)

@thelindat
Copy link
Contributor Author

You can safely ignore the error.

@M4GmA
Copy link

M4GmA commented Mar 3, 2024

ehhhh du vorte

@MauriceHandwerker
Copy link

Any new infos ? I have almost the same right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ScRT: JS Issues/PRs related to the JavaScript scripting runtime triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

4 participants