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

Bus Error #7

Closed
wesbos opened this issue Aug 3, 2023 · 15 comments
Closed

Bus Error #7

wesbos opened this issue Aug 3, 2023 · 15 comments

Comments

@wesbos
Copy link

wesbos commented Aug 3, 2023

Hello, thank you for this library.

I'm having an issue with the following code in Node.js v20.1.0, but also appears on LTS v18.17.0

test.js:

import { FFmpeg } from "@ffmpeg.wasm/main";
const ffmpeg = await FFmpeg.create()

running node test.js I get "bus error".

I'm not able to catch any errors, nor see whats causing this. Any idea how to debug?

Screenshot 2023-08-03 at 2 43 59 PM

package.json:

{
  "name": "ffmpeg-delete-me",
  "version": "0.0.1",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "Wes Bos (https://wesbos.com/)",
  "license": "MIT",
  "dependencies": {
    "@ffmpeg.wasm/core-mt": "^0.13.2",
    "@ffmpeg.wasm/main": "^0.13.0"
  },
  "type": "module"
}
@wesbos
Copy link
Author

wesbos commented Aug 3, 2023

Seems to be happening when requiring the core in importCore function. Both core-mt and core-st create a bus error

@wesbos
Copy link
Author

wesbos commented Aug 3, 2023

Dug a bit deeper - its this line:

      let core = yield (yield importCore(options.core, logger))({
        arguments: VERSION_ARGS,

VERSION_ARGS is ["ffmpeg", "-version"] and I guess when it runs that, it chokes? Replacing it with ["echo", "hello"] still breaks, so when the command is run its throwing a bus error

@wesbos
Copy link
Author

wesbos commented Aug 3, 2023

Reverting the core to "@ffmpeg.wasm/core-mt": "0.12.0", seems to not be throwing the error. Still on latest for the main package.

@wesbos
Copy link
Author

wesbos commented Aug 3, 2023

Sorry for all the comments. They don't seem to work together. this.core._free is not a function

@DreamOfIce
Copy link
Member

You can add log: true to the options of FFmpeg.create(), this should log some useful information

@wesbos
Copy link
Author

wesbos commented Aug 4, 2023

I tried that,this code:

import { FFmpeg } from "@ffmpeg.wasm/main"
const ffmpeg = FFmpeg.create({
  log: true,
  logger: (level, message) => console.log(level, message),
});

Gives me:

node test.js
debug Import '@ffmpeg.wasm/core-mt' with cjs require()
[1]    39199 bus error  node test.js

@DreamOfIce
Copy link
Member

Cloud you provide a more detailed system and environment info?
I can't reproduce this problem with nodejs v18.17.0 under Windows10 or Debian12.

@wesbos
Copy link
Author

wesbos commented Aug 4, 2023

Macbook Pro, 2021 Apple M1 Max.

Node v18.17.0
npm 9.6.7

    "@ffmpeg.wasm/core-mt": "0.13.2",
    "@ffmpeg.wasm/core-st": "0.13.2",
    "@ffmpeg.wasm/main": "0.13.0"

I tried to replicate it here, but it does work. So maybe it's an apple silicon issue? https://codesandbox.io/p/sandbox/jolly-mccarthy-pmw9gd?file=%2Findex.js%3A8%2C1

@wesbos
Copy link
Author

wesbos commented Aug 4, 2023

I'm collecting data over here: wesbos/ff-me#1

So far it seems to happen only on Mac OS, both intel and silicon chips.

@evayde
Copy link

evayde commented Aug 4, 2023

The tests of the project also fail on Mac. Same error message.

@DreamOfIce
Copy link
Member

Have you tried core-st? Will there still be the same error?

@DreamOfIce
Copy link
Member

You can clone DreamOfIce/ffmpeg.wasm-core and uncomment this line:

https://github.com/DreamOfIce/ffmpeg.wasm-core/blob/6690593aa6b014dad266efa97293e32d27499c0c/wasm/bu ild-scripts/var.sh#L32

Then run ./build.sh to build debug version of the core.

Switch to the local core through pnpm add -D /path/to/ffmpeg.wasm-core /packages/core-mt/.

Then run the test again, and you should be able to see more detailed output.

@DreamOfIce
Copy link
Member

It looks like this issue has been fixed in the latest v20.5.0
But not yet fixed in v18.17.0 LTS
wesbos/ff-me#1 (comment)

@evayde
Copy link

evayde commented Aug 5, 2023

It looks like this issue has been fixed in the latest v20.5.0 But not yet fixed in v18.17.0 LTS wesbos/ff-me#1 (comment)

Confirmed! This issue doesn't exist in Node 20.5.0 on Mac

@wesbos
Copy link
Author

wesbos commented Aug 7, 2023

looks like it's working on 20.5.0 - thank you everyone!

@wesbos wesbos closed this as completed Aug 7, 2023
@DreamOfIce DreamOfIce pinned this issue Aug 24, 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

3 participants