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

V*:internal Error while cloning an axios object #115

Closed
mlibre opened this issue Jun 27, 2020 · 6 comments
Closed

V*:internal Error while cloning an axios object #115

mlibre opened this issue Jun 27, 2020 · 6 comments

Comments

@mlibre
Copy link

mlibre commented Jun 27, 2020

Axios produces a very large/complex object of the Request.

When I was trying clone this object, I got v8:internal errror.

@yury-kozlov
Copy link

yury-kozlov commented Aug 14, 2020

Probably, you mean this error (coming from V8 engine): FATAL ERROR: v8::Object::SetInternalField() Internal field out of bounds
It happens when clone tries to access some native fields of httpResponse, like connection, socket, etc.
I would be glad to know how to prevent this error too, as it crashes the whole application.
Related:

@doublemcz
Copy link

+1 I would say it is necessary to remove socket connections from the object. It happens with MongoDB connection as well.

@aliclark
Copy link

I've opened a related issue nodejs/node#37369

The bug is triggered on

clone/clone.js

Line 165 in 6df949a

child[i] = _clone(parent[i], depth - 1);
because of the assignment child[i] = , which attempts to set the 'onread' attribute of the node socket, crashing.

Although the crash is a bug in node, it still could be a bug the fact that it was triggered.

At

clone/clone.js

Line 121 in 6df949a

child = Object.create(proto);
and

clone/clone.js

Line 124 in 6df949a

child = Object.create(prototype);
a fresh object is created but using a reference to the original prototype. I think in this case the object was a magic Proxy-like object, where assignment of this specific property caused a crash, but in general I think this could crop up with other types of code where the prototype has setter or proxy behaviours.

@girishghoda
Copy link

@aliclark any fix or temporary hack of this?

@aliclark
Copy link

aliclark commented Feb 10, 2022

@aliclark any fix or temporary hack of this?

Hi @girishghoda, I believe you just need to remove reference to the node socket from the source object before you perform clone - attempting to clone an internal property of the socket is what causes a crash.

@mlibre
Copy link
Author

mlibre commented Oct 22, 2023

@mlibre mlibre closed this as completed Oct 22, 2023
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

No branches or pull requests

5 participants