citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.58k stars 2.12k forks source link

UnhandledPromiseRejectionWarning: Error: BUFFER_SHORTAGE #2337

Open thelindat opened 10 months ago

thelindat commented 10 months ago

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

TeKGameR950 commented 10 months ago

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 commented 10 months ago

You can safely ignore the error.

M4GmA commented 9 months ago

ehhhh du vorte

MauriceHandwerker commented 6 months ago

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