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

Incompatibility with Electron 21 #51

Closed
zegenie opened this issue Nov 5, 2022 · 5 comments
Closed

Incompatibility with Electron 21 #51

zegenie opened this issue Nov 5, 2022 · 5 comments

Comments

@zegenie
Copy link

zegenie commented Nov 5, 2022

Thanks so much for finally taking on the task of building a modern steamworks api.

We're trying to use this library in an Electron 21-wrapped application, but have run into a compatibility issue with the new V8 memory cage as described here: https://www.electronjs.org/blog/v8-memory-cage

This causes Chromium/Electron to fatal crash whenever we're trying to for example retrieve the session ticket via the api:
[167373:1105/112515.909269:ERROR:node_bindings.cc(146)] Fatal error in V8: v8_ArrayBuffer_NewBackingStore When the V8 Sandbox is enabled, ArrayBuffer backing stores must be allocated inside the sandbox address space. Please use an appropriate ArrayBuffer::Allocator to allocate these buffers

As a result, it is impossible to use this as a node module in Electron 21 and onwards because of this. Trying to disable the sandbox either via launch parameters or sandbox: false has no effect on this setting. Apparently this issue needs to be fixed at the module level as described in the link above, where it mentions this:

This change only affects native Node modules which allocate memory outside of the V8 heap (e.g. using malloc or new) and then wrap the external memory with an ArrayBuffer. This is a fairly rare use case, but some modules do use this technique, and such modules will need to be refactored in order to be compatible with Electron 20+

I don't know enough about the internals to know how to suggest this fix in a PR, or even where to suggest it, but the end result is still that it renders this module incompatible with Electron 20+ 😞

@zegenie
Copy link
Author

zegenie commented Nov 5, 2022

The issue arises when trying to call ticket.getBytes() on the value passed from the auth.getSessionTicket() promise:

const steam_appid = <our_steam_appid>;
const steamclient = steamworks.init(steam_appid);
steamclient.auth.getSessionTicket()
        .then(ticket => {
            console.info(ticket.getBytes());
        });

This code works in Electron 20, but from Electron 21 it causes a fatal V8 error.

@ceifa
Copy link
Owner

ceifa commented Nov 16, 2022

Related napi-rs/napi-rs#1346

@James226
Copy link
Contributor

I've tested this with the latest version of napi-rs now napi-rs/napi-rs#1346 is resolved, and this seems to have resolved the issue. Any chance we can get a rebuild?

@oyed
Copy link

oyed commented Jan 25, 2023

Would love a rebuild too, need to start upgrading Electron!

@ceifa
Copy link
Owner

ceifa commented Jan 27, 2023

Fixed on 0.0.27

@ceifa ceifa closed this as completed Jan 27, 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

4 participants