Compiling issue under ubuntu:20.04

Hi,

Not sure what I am doing wrong, less sure about a bug so I have the following output when I try to run a server app using mediasoup:

mediasoup createWorker() +0ms
  mediasoup:Worker constructor() +0ms
  mediasoup:Worker spawning worker process: /node_modules/mediasoup/worker/out/Release/mediasoup-worker --logLevel=error --rtcMinPort=10000 --rtcMaxPort=10100 +0ms
  mediasoup:Channel constructor() +0ms
  mediasoup:PayloadChannel constructor() +0ms
  mediasoup:ERROR:Worker (stderr) /node_modules/mediasoup/worker/out/Release/mediasoup-worker: 1: �������H__PAGEZEROx__TEXT@6@6__text__TEXT@: not found +0ms
  mediasoup:ERROR:Worker (stderr) /node_modules/mediasoup/worker/out/Release/mediasoup-worker: 2: �-@
                                                                                                     �__stubs__TEXT: not found +1ms
  mediasoup:ERROR:Worker (stderr) /node_modules/mediasoup/worker/out/Release/mediasoup-worker: 3: .b: not found +0ms
  mediasoup:ERROR:Worker (stderr) /node_modules/mediasoup/worker/out/Release/mediasoup-worker: 5: Syntax error: word unexpected (expecting ")") +0ms
  mediasoup:Channel Producer Channel ended by the worker process +7ms
  mediasoup:Channel Consumer Channel ended by the worker process +1ms
  mediasoup:PayloadChannel Producer PayloadChannel ended by the worker process +8ms
  mediasoup:PayloadChannel Consumer PayloadChannel ended by the worker process +0ms
  mediasoup:Worker close() +16ms
  mediasoup:Channel close() +2ms
  mediasoup:PayloadChannel close() +3ms
  mediasoup:ERROR:Worker worker process failed unexpectedly [pid:37, code:2, signal:null] +0ms
[2021-07-30T11:21:50.332] [ERROR] server - Error occurred while server is being started Error: [pid:37, code:2, signal:null]
    at ChildProcess.Worker._child.on (/node_modules/mediasoup/lib/Worker.js:122:43)
    at ChildProcess.emit (events.js:198:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)

seems like the compiled bin file is problematic. lead me to the conclusion that I compile it somehow wrong.

The environment:
I try run the server app inside a docker image: FROM ubuntu:20.04
mediasoup version: 3.8.0
node v10.19.0
gcc 9.3.0
npm 6.14.4

Any idea what I miss?

Can you please follow the guidelines here to get the core dump and open a GH issue as indicated there?

Thank you for your quick reply.

I was/am not sure if it is really an issue or I miss something obvious at first glance for someone, but let’s spread the problem forward as you requested:

I have a suspicion that due to being on macOS you might have compiled worker on macOS and now trying to run it under Docker. Make sure you don’t include node_modules into your Docker context. Can’t tell much more without Dockerfile.

2 Likes

From Dockerfile on GitHub:

RUN npm install -g node-gyp
COPY ["package.json", "package-lock.json*", "./"]
RUN npm install
COPY . .

This is precisely your problem: you build worker under Ubuntu and then replace it with one built on macOS. Obviously those are different executables.

  1. Never use COPY . ., copy specific files and directories you need
  2. Always include .dockerignore and put things like node_modules into it
  3. Not sure where you’ve got npm install -g node-gyp from, but it is not needed here

Good finding. I’ll close the issue in GH.

Oh it was already :slight_smile: