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

Core dump with vitest and simple-peer #222

Closed
xurei opened this issue Mar 11, 2024 · 9 comments
Closed

Core dump with vitest and simple-peer #222

xurei opened this issue Mar 11, 2024 · 9 comments

Comments

@xurei
Copy link

xurei commented Mar 11, 2024

Versions:

  • node-datachannel: 0.5.3
  • vitest: 1.3.1
  • simple-peer: 9.11.1
  • node: tested 18 and 20, same behavior

All latest at the time of the creation of this issue.

OS:

Linux (Pop OS, most likely happening in Ubuntu too)

Issue:

When I use Vitest to test the simplest code (taken from https://github.com/murat-dogan/node-datachannel/tree/master/examples/simple-peer-usage), vitest crashes with a core dump.
I suspect it's because it runs in a Worker, maybe related to #129 ?

Repository for reproduction:

https://github.com/xurei/vitest-node-datachannel-crash

Verbose log attached:

log.txt

I'm available if you need any more tests/informations on my side.

Note that I had a similar issue when I tried the same thing with wrtc, so it might be a problem on Vitest side.

@xurei
Copy link
Author

xurei commented Mar 11, 2024

Update: by using vitest --pool=forks instead of vitest, the issue goes away.

I don't know if/whether this should be fixed in this repository. Feel free to close this issue if you won't/can't fix this on your side. 🙂

@murat-dogan
Copy link
Owner

Hello,
thanks for reporting.
Could you please also try the latest release v0.5.4?

And also please check this issue and comment.
#172 (comment)

@xurei
Copy link
Author

xurei commented Mar 13, 2024

Thanks for the quick reply.

The core dump still happens with v0.5.4

I'm not sure how to add node.cleanup() in a vitest suite.
I tried this

  afterEach(() => {
    node.cleanup()
  });

but I get ReferenceError: node is not defined.

Any idea ?

@murat-dogan
Copy link
Owner

You should import import node from 'node-datachannel'

And I think you should call cleanup just before exiting the test not after all

@murat-dogan
Copy link
Owner

It seems there is another issue, you can check here #223

@murat-dogan
Copy link
Owner

I have just published v0.5.5
Could you please try it?

@xurei
Copy link
Author

xurei commented Mar 22, 2024

Sorry for the delay.

I tried with 0.5.4 and node.cleanup() as you suggested. It works 🎉

I also tried with 0.5.5. It works even without node.cleanup() 🎉

The live reload feature of vitest is apparently still broken (no big deal for me) :

FAIL node-datachannel.test.js [ node-datachannel.test.js ]
Error: Module did not self-register: '/home/olivier/vitest-node-datachannel-crash/node_modules/node-datachannel/build/Release/node_datachannel.node'.
 ❯ node_modules/node-datachannel/lib/index.js:5:25

No idea what it means 🤷
See https://github.com/xurei/vitest-node-datachannel-crash/tree/v0.5.5-fix

@murat-dogan
Copy link
Owner

Hello,
https://github.com/murat-dogan/node-datachannel/releases/tag/v0.9.0
Could you also try with latest release?

@murat-dogan
Copy link
Owner

I am closing the issue. Please feel free to open if you need to.

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

2 participants