I have an error creating a worker with Mediasoup 3.6.16

Hello,

I have a server using “mediasoup 3.6.16”, on my local MAC computer it works without problems, but now I am trying to install it on a machine with Centos 6, to test it in a real environment,

System detail:
Node v10.23.0
Python v2.7.18
gcc y g++ v4.9.3
npm v6.14.8
Port: 9001 (open state)

I have no problem running npm install, but when I try to run npm start I get the following error:

root@aw0241 [/opt/mediasoup/server]# npm start                                                                                                                                     
                                                                                                                                                                                               
> mediasoup-custom@1.0.0 start /opt/mediasoup/server                                                                                                                                           
> node src/app.js                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                                                                                      
listening https 9001                                                                                                                                                                           
(node:17126) UnhandledPromiseRejectionWarning: Error: [pid:17133, code:1, signal:null]                                                                                                         
    at ChildProcess.Worker._child.on (/opt/mediasoup/server/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)
(node:17126) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:17126) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The error is occurring when trying to create a worker await mediasoup.createWorker({})

(async () => {
   await createWorkers()
})()
async function createWorkers() {
    let {
        numWorkers
    } = config.mediasoup
 
    for (let i = 0; i < numWorkers; i++) {
           
        let worker = await mediasoup.createWorker({
            logLevel: config.mediasoup.worker.logLevel,
            logTags: config.mediasoup.worker.logTags,
            rtcMinPort: config.mediasoup.worker.rtcMinPort,
            rtcMaxPort: config.mediasoup.worker.rtcMaxPort,
        })
        
        worker.on('died', () => {
            console.error('mediasoup worker died, exiting in 2 seconds... [pid:%d]', worker.pid);
            setTimeout(() => process.exit(1), 2000);
        })
        
        workers.push(worker)
        
    }
}

In the config, the cert.pem and key.pem are already configured

I hope to have your help, I have been all day trying to solve this problem.

PD: Sorry if it’s not well written, I don’t speak English, I’m using a translator.

thank you

I was have the same issue. And delete node_modules and run cmd ‘npm install’ to reinstall all modules solved this issue for me. I think this issue appear because i move all mediasoup server(include node_modules) from another ubuntu server to windows server.

If you don’t set the DEBUG environment variable properly (check the Debugging section in mediasoup docs) you won’t see the error.

I already tried to delete the node_modules folder and install again, but the error persists.

Cool. Now do what I said instead of any other random thing.

Now i ran it with the DEBUG enabled and it gave me the following

root@aw0241 [/opt/mediasoup/server]# DEBUG="mediasoup* *ERROR*" node src/app.js 

**mediasoup** createWorker() +0ms
**mediasoup:Worker** constructor() +0ms
**mediasoup:Worker** spawning worker process: /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker --logLevel=warn --logTag=info --logTag=ice --logTag=dtls --logTag=rtp --logTag=srtp --logTag=rtcp --rtcMinPort=10000 --rtcMaxPort=10100 +0ms
**mediasoup:Channel** constructor() +0ms
**mediasoup:PayloadChannel** constructor() +0ms

listening https 9001

**mediasoup:ERROR:Worker** (stderr) /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker) +0ms
**mediasoup:ERROR:Worker** (stderr) /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker) +0ms
**mediasoup:ERROR:Worker** (stderr) /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker) +0ms
**mediasoup:ERROR:Worker** (stderr) /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker) +0ms
**mediasoup:ERROR:Worker** (stderr) /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker) +0ms
**mediasoup:ERROR:Worker** (stderr) /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /opt/mediasoup/server/node_modules/mediasoup/worker/out/Release/mediasoup-worker) +0ms
**mediasoup:Channel** Producer Channel ended by the worker process +7ms
**mediasoup:Channel** Consumer Channel ended by the worker process +0ms
**mediasoup:PayloadChannel** Producer PayloadChannel ended by the worker process +6ms
**mediasoup:PayloadChannel** Consumer PayloadChannel ended by the worker process +1ms
**mediasoup:Worker** close() +13ms
**mediasoup:Channel** close() +1ms
**mediasoup:PayloadChannel** close() +2ms
**mediasoup:ERROR:Worker** worker process failed unexpectedly [pid:470, code:1, signal:null] +0ms

(node:457) UnhandledPromiseRejectionWarning: Error: [pid:470, code:1, signal:null]
at ChildProcess.Worker._child.on (/opt/mediasoup/server/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)
(node:457) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:457) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Thanks for the help, for me it was solved by installing the missing libraries

CXXABI_1.3.8
GLIBCXX_3.4.18
CXXABI_1.3.5
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.20

With this the service started correctly,

now I’m going to check the link you shared with me “Crashes in mediasoup (get a core dump)”,

Thanks for your help,