josdejong / workerpool

Offload tasks to a pool of workers on node.js and in the browser
Apache License 2.0
2.04k stars 148 forks source link

terminate(true) didn't kill the pool process #418

Closed mostafa-hisham closed 7 months ago

mostafa-hisham commented 8 months ago

using this example

        let result = null;
        try {
             result = await pool.exec('doTheWork', [job]).timeout(5000);
        }catch (err){
            console.log(err);
            result = {
                code:500,
                ...err
            }
        }
        await pool.terminate(true);
        return result;

on catching a timeout error terminate(true) didn't kill the pool process and this result = await pool.exec('doTheWork', [job]).timeout(5000); didn't kill the process too

doTheWork function has an infinite loop

        while (true){
            console.log(new Date().getTime());
        }
josdejong commented 8 months ago

Thanks for reporting. I tried to reproduce what you describe but without success. Can you work out a complete example demonstrating the issue?

josdejong commented 7 months ago

@mostafa-hisham how can we reproduce your issue exactly?

josdejong commented 7 months ago

Closing this issue due to a lack of response.