Bad Parameter in also in async
Closed this issue · 8 comments
i tried to debug it more, here is what i have seen from the bindings module messages (OBS SRT Encoder)
Exception thrown by native binding call "SRT.accept(...[44841253]);": Error: Operation not supported: Bad parameters
at MessagePort. (/opt/4tbdrive1/experiments/nodejs_srt/node_modules/@eyevinn/srt/src/async-worker.js:60:43)
at MessagePort.emit (events.js:314:20)
at MessagePort.onmessage (internal/worker/io.js:80:8)
at MessagePort.exports.emitMessage (internal/per_context/messageport.js:11:10)
AsyncSRT: Error from task-runner: Operation not supported: Bad parameters
Binding call: SRT.accept(...[44841253]);
Source i tried:
"use strict";
const { AsyncSRT } = require('@eyevinn/srt');
const asyncSrt = new AsyncSRT();
(async function() {
const socket = await asyncSrt.createSocket(false);
console.log('createSocket() result:', socket);
let result = await asyncSrt.bind(socket, "172.28.115.51", 1234);
console.log('bind() result:', result);
result = await asyncSrt.listen(socket, 2);
console.log('listen() result:', result);
awaitConnections(socket);
})();
async function awaitConnections(socket) {
console.log('Awaiting incoming client connection ...');
const fd = await asyncSrt.accept(socket);
console.log('New incoming client fd:', fd);
}
setInterval(() => {
console.log('Doing other stuff in the meantime ... :)');
}, 1000);
Hi @rebotnix
Please take a look at: https://github.com/Eyevinn/node-srt/blob/master/integration-tests/async_srt_client_server_test.js
which validates that async API works. It also works in our application.
I am not able to tell anything more about your case without more details.
Can you post more log output from running that example code you are posting maybe?
In order for anyone here to help, I think you'll have to simply provide more high quality issue posts:
-
A better description of steps that you perform, what exactly happens on either side of components (also the "SRT encoder" that you use).
-
Please try to use markdown syntax when quoting code, posting logs, or mention technical symbols (for example https://www.markdownguide.org/extended-syntax/#fenced-code-blocks and https://www.markdownguide.org/basic-syntax/#code for inline rendered)
-
Please come up with (or fix) title of the issue to something somewhat more descriptive of the error, and semantically/gramatically meaningful english (or german if you prefer, but that will be less inclusive in terms of potential audience).
Same problem here.
I belive i've followed as much as possible from: https://github.com/Eyevinn/node-srt/blob/master/integration-tests/async_srt_client_server_test.js
Not using any encoder, only trying to create a data tunnel between two points.
Can you consider this replicable test?
const { SRT, AsyncSRT, SRTServer } = require('@eyevinn/srt');
const sleep = m => new Promise(r => setTimeout(r, m))
const port = 5564
const ip = "127.0.0.1"
async function start(){
const server = new SRTServer(port);
server.on('connection', (connection) => {
connection.on("data", async ()=>{
while(true) {
//not the same of the example here, but i believe the error is happening before this code
const buff = await connection.read(16*1024)
if (buff instanceof Uint8Array) {
console.log(Buffer.from(buff).toString())
} else break;
}
})
});
await server.create()
await server.open()
await sleep(1000)
const client = new AsyncSRT();
const socket = await client.createSocket()
let result = await client.connect(socket, ip, port);
if (result === SRT.ERROR) {
throw new Error('client connect failed');
}
await sleep(1000) //error after this part
//not the same of the example here, but i believe the error is happening before this code
await client.write(socket, Buffer.from("abcdefg"))
console.log("done")
}
start().catch((e)=>{
console.log(e)
})
In the accept command from server i get this error:
Exception thrown by native binding call "SRT.accept(...[161416980]);": Error: Operation not supported: Bad parameters
at MessagePort.<anonymous> (/home/ivuser/git/_test/srt-socket/node_modules/@eyevinn/srt/src/async-worker.js:60:43)
at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:399:41)
at MessagePort.exports.emitMessage (node:internal/per_context/messageport:18:26)
AsyncSRT: Error from task-runner: Operation not supported: Bad parameters
Binding call: SRT.accept(...[161416980]);
Thanks
Did another test using SRT direct, same thing.
Server code:
const { SRT, AsyncSRT, SRTServer } = require('@eyevinn/srt');
const sleep = m => new Promise(r => setTimeout(r, m))
const port = 5564
const ip = "127.0.0.1"
async function start(){
const srt = new SRT();
const server = srt.createSocket();
if (server !== -1) {
console.log("Created socket: " + server);
}
let result;
result = srt.bind(server, "0.0.0.0", port);
if (!result) {
console.log("Bind success");
} else {
console.log(result);
}
result = srt.listen(server, 2);
if (!result) {
console.log("Listen success");
} else {
console.log(result);
}
let connection = srt.accept(server);
if (connection) {
const chunk = srt.read(connection, 1316);
if (chunk) console.log("Read chunk: " + chunk.length);
}
console.log("done")
}
start().catch((e)=>{
console.log(e)
})
Client code:
const { SRT, AsyncSRT, SRTServer } = require('@eyevinn/srt');
const sleep = m => new Promise(r => setTimeout(r, m))
const port = 5564
const ip = "127.0.0.1"
async function start(){
const srt = new SRT();
const client = srt.createSocket();
if (client !== -1) {
console.log("Created socket: " + client);
}
result = srt.connect(client, ip, port);
if (!result) {
console.log("connect success");
} else {
console.log(result);
}
srt.write(client, Buffer.from("abcdfg"));
await sleep(15000)
console.log("done")
}
start().catch((e)=>{
console.log(e)
})
Result:
Error: Operation not supported: Bad parameters
at start (/home/ivuser/git/_test/srt-socket/test/index.js:25:27)
at Object.<anonymous> (/home/ivuser/git/_test/srt-socket/test/index.js:33:1)
at Module._compile (internal/modules/cjs/loader.js:1060:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
Just after the client connection.
Note: I'm using the lastest npm package
Good news, i've made a custom build of srt v.1.4.1 and the problem disappeared.
It looks like it's an incompability with newer version of SRT.