Skip to content
New issue

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

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

Already on GitHub? # to your account

Regression v10.x node_file.cc:1713: Assertion `(off) <= (buffer_length)' failed. #24640

Closed
thisconnect opened this issue Nov 25, 2018 · 7 comments
Labels
buffer Issues and PRs related to the buffer subsystem. confirmed-bug Issues with confirmed bugs. help wanted Issues that need assistance from volunteers or PRs that need help to proceed.

Comments

@thisconnect
Copy link

Hi, I have a really simple module fildes that basically wraps the filesystem api in promises and provides a few useful defaults options. I just updated the CI's to run also against node 10. The module has a few tests and also tests weird input to increase coverage.

Since node v10 there are some v8 internal errors(?)
possible duplicate #23668

I just found #23668 with a very similar error, please let me know if it is worth pursuing this i.e. try to make a small code example that reproduces the error.

#on appveyor
src\node_file.cc:1713: Assertion `(off) <= (buffer_length)' failed.
# or travis
node[114]: ../src/node_file.cc:1713:void node::fs::WriteBuffer(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `(off) <= (buffer_length)' failed.

#locally
  write file in a new directory
    ✓ correct content
node[17121]: ../src/node_file.cc:1713:void node::fs::WriteBuffer(const FunctionCallbackInfo<v8::Value> &): Assertion `(off) <= (buffer_length)' failed.

  write twice with manually opened fd
    ✓ correct content
 1: 0x10003777e node::Abort() [<path>/bin/node]

  write with invalid offset
 2: 0x1000368be node::AddEnvironmentCleanupHook(v8::Isolate*, void (*)(void*), void*) [<path>/bin/node]
 3: 0x1000680df node::fs::WriteBuffer(v8::FunctionCallbackInfo<v8::Value> const&) [<path>/bin/node]
 4: 0x100227301 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [<path>/bin/node]
 5: 0x1002267ef v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [<path>/bin/node]
 6: 0x100225ec8 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [<path>/bin/node]
 7: 0x1759cc95be3d 
 8: 0x1759cc9118d5 
 9: 0x1759cc9118d5 
10: 0x1759cc9faf86 
@Trott
Copy link
Member

Trott commented Nov 25, 2018

/ping @cjihrig

@refack
Copy link
Contributor

refack commented Nov 25, 2018

Hello @thisconnect,
IMO your error is different then the one in #23668, also that issue was specifically patched for 10.13.0 in #23795.

So if you could find a minimal code snippet that reproduces this issue tat would be very helpful (for that issue it was Buffer.alloc(1).copy(Buffer.alloc(1), 'err'))

@refack refack added buffer Issues and PRs related to the buffer subsystem. v10.x labels Nov 25, 2018
@thisconnect
Copy link
Author

thisconnect commented Nov 25, 2018

@refack sure. This is on v10.13.0 on macOS

// write with invalid offset

  const fs = require('fs');

  fs.open('./test.txt', 'w+', (err, fd) => {
    if (err) throw err;
    fs.write(fd, Buffer.alloc(0), -1, (err, bytesWritten) => console.log(err, bytesWritten));
  });

@thisconnect
Copy link
Author

please note that the only purpose of this was to produce an error and improve coverage a bit.

thisconnect pushed a commit to thisconnect/fildes that referenced this issue Nov 25, 2018
@refack
Copy link
Contributor

refack commented Nov 25, 2018

@thisconnect does this reproduce with node 10.9.0? NM, I can test it myself 🤦‍♂️
P.S. yes it does reproduce with 10.9.0, so it's independent of #22129

@jasnell jasnell added the help wanted Issues that need assistance from volunteers or PRs that need help to proceed. label Jun 26, 2020
@jasnell
Copy link
Member

jasnell commented Apr 26, 2021

This is still an issue on 16.0 ...

>
>   fs.open('./test.txt', 'w+', (err, fd) => {
...     if (err) throw err;
...     fs.write(fd, Buffer.alloc(0), -1, (err, bytesWritten) => console.log(err, bytesWritten));
...   });
undefined
> node[9689]: ../src/node_file.cc:1834:void node::fs::WriteBuffer(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `(off_64) >= (0)' failed.
 1: 0xb12b00 node::Abort() [node]
 2: 0xb12b7e  [node]
 3: 0xb213ea  [node]
 4: 0xd5f70b  [node]
 5: 0xd60bac  [node]
 6: 0xd61226 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
 7: 0x160c579  [node]
Aborted
root@DESKTOP-5KK9VIR:~/node/tmp# node -v
v16.0.0

@jasnell jasnell added confirmed-bug Issues with confirmed bugs. and removed v10.x labels Apr 26, 2021
jasnell added a commit to jasnell/node that referenced this issue Apr 26, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>
Fixes: nodejs#24640
jasnell added a commit to jasnell/node that referenced this issue Apr 27, 2021
Fixes: nodejs#24640
Signed-off-by: James M Snell <jasnell@gmail.com>
@thisconnect
Copy link
Author

Thank you 🙏

targos pushed a commit that referenced this issue Apr 29, 2021
Fixes: #24640
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #38421
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
targos pushed a commit that referenced this issue May 30, 2021
Fixes: #24640
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #38421
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
targos pushed a commit that referenced this issue Jun 5, 2021
Fixes: #24640
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #38421
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
targos pushed a commit that referenced this issue Jun 5, 2021
Fixes: #24640
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #38421
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
targos pushed a commit that referenced this issue Jun 11, 2021
Fixes: #24640
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #38421
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
buffer Issues and PRs related to the buffer subsystem. confirmed-bug Issues with confirmed bugs. help wanted Issues that need assistance from volunteers or PRs that need help to proceed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants