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

Node fs package throws: Assertion `args[3]->IsInt32()' failed. #36643

Closed
edu81 opened this issue Dec 27, 2020 · 3 comments
Closed

Node fs package throws: Assertion `args[3]->IsInt32()' failed. #36643

edu81 opened this issue Dec 27, 2020 · 3 comments
Labels
fs Issues and PRs related to the fs subsystem / file system.

Comments

@edu81
Copy link

edu81 commented Dec 27, 2020

- Node Version: v13.7.0

- Platform: MacBook Pro Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

What steps will reproduce the bug?

Tried to run a script to download zip files from Google Drive: first file OK (2Gb aprox), second file OK (1.5Gb), third file NOT OK (aprox 3GB)
The code running at this point is:

`await Promise.all(driveFiles.map((file) => googleDrive.downloadFileById(file))).then((downloaded) => downloaded.forEach((d) => console.log(d)));`

dependency is:

const googleDrive = require('./googleApi.js');

and googleApi.js is code to download from Google Drive copy/pasted from example docs:

https://developers.google.com/drive/api/v3/manage-downloads

How often does it reproduce? Is there a required condition?

Everytime when I run it. I run via nodemon mainScript.js

What is the expected behavior?

Files downloaded from my Google Drive and paths printed in console

What do you see instead?

First and second file download OK and when trying to download thhird file i get:

Inode[4463]: ../src/node_file.cc:1833:void node::fs::WriteBuffer(const FunctionCallbackInfo<v8::Value> &): Assertion `args[3]->IsInt32()' failed.
 1: 0x101366e15 node::Abort() (.cold.1) [/...<pathToMyNodeProjectsFolder>.../nodeProjects/testDownloadApi/node_modules/.bin/node]
 2: 0x1000be439 node::Abort() [/...<pathToMyNodeProjectsFolder>.../nodeProjects/testDownloadApi/node_modules/.bin/node]
 3: 0x1000be2a1 node::Assert(node::AssertionInfo const&) [...<pathToMyNodeProjectsFolder>.../nodeProjects/testDownloadApi/node_modules/.bin/node]
 4: 0x1000cf254 node::fs::WriteBuffer(v8::FunctionCallbackInfo<v8::Value> const&) [/...<pathToMyNodeProjectsFolder>.../nodeProjects/testDownloadApi/node_modules/.bin/node]
 5: 0x1002a2948 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/...<pathToMyNodeProjectsFolder>.../nodeProjects/testDownloadApi/no
@targos targos added the fs Issues and PRs related to the fs subsystem / file system. label Dec 27, 2020
RaisinTen added a commit to RaisinTen/node that referenced this issue Dec 28, 2020
Since `length` is `size_t`, it can accept 64-bit integers too.

Refs: https://man7.org/linux/man-pages/man2/write.2.html
Fixes: nodejs#36643
@edu81
Copy link
Author

edu81 commented Dec 30, 2020

why is this closed? what is the resolution?

danielleadams pushed a commit that referenced this issue Jan 12, 2021
Since `length` is `size_t`, it can accept 64-bit integers too.

Refs: https://man7.org/linux/man-pages/man2/write.2.html
Fixes: #36643

PR-URL: #36667
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yash Ladha <yash@yashladha.in>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
targos pushed a commit that referenced this issue May 1, 2021
Since `length` is `size_t`, it can accept 64-bit integers too.

Refs: https://man7.org/linux/man-pages/man2/write.2.html
Fixes: #36643

PR-URL: #36667
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yash Ladha <yash@yashladha.in>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
@Ayase-252
Copy link
Member

Per #38546, I reopen the issue, since it turned to a confusing Error now.

node:internal/fs/utils:343
    throw err;
    ^

Error: EINVAL: invalid argument, write
    at Object.writeSync (node:fs:882:3)
    at Object.<anonymous> (/Users/qingyudeng/projects/node/index.js:5:16)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  errno: -22,
  syscall: 'write',
  code: 'EINVAL'
}

@Ayase-252 Ayase-252 reopened this May 5, 2021
@Ayase-252
Copy link
Member

Since #38546 landed, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants