Thread: Unable to terminate process started from PLV8 function

Unable to terminate process started from PLV8 function

From
Mukesh Chhatani
Date:
Hello Team,

We are trying to use PLV8 function to calculate the histograms and while testing the function
we found that with some of the data, function was going into the infinite loop.

We tried to kill the session using pg_terminate_backend(pid) but process could not get killed,
we terminated the process using kill pid still no luck , then we tried , kill -9 PID and it terminated postmaster also and restarted the database.

Below is the sample function to reproduce the infinite loop

CREATE FUNCTION test_infinite () returns void as $$  while (true) {(new Date).toISOString(); } $$ LANGUAGE plv8 IMMUTABLE STRICT;;

Please let me know if someone has ever noticed this or is this the expected behavior with PLV8 extension or do I have to report the issue to PLV8 or V8 groups.

Thanks for your help in advance.

Regards,
Mukesh