Next question... the `timeout` param on `<cfsto...
# lucee
a
Next question... the
timeout
param on
<cfstoredproc>
(https://docs.lucee.org/reference/tags/storedproc.html#attribute-timeout). At the timeout, does this send some sort of "terminate" request to the DB server to kill the proc, or does Lucee simply stop waiting for the DB to come back (and in the background, the proc is still churning away on the DB server). I might try to come up with some sort of test to find out, but just wondered if someone knows? It'd be great if this sort of thing was in the docs, rather than just "timeout for the stored procedure.", which is just stating the obvious, and not even really worth saying, I think.
OK, I don't think the
timeout
attribute works reliably. But... my knowledge of JDBC & MySQL procs beyond "they are def both things that exist" is minimal. I concocted a test:
Copy code
DELIMITER ;;
CREATE PROCEDURE test_timeout()
BEGIN
    declare i INT default 0;
    SET i = 1;

	WHILE i <= 10 DO
		INSERT INTO test (value) values (CONCAT('Proc test row ', i, ' @ ', TIME(NOW())));
		SELECT SLEEP(1);
		SET i = i + 1;
	END WHILE;
END ;;
So does a wee loop and inserts a record every second for 10sec.
Copy code
<cfstoredproc procedure="test_timeout" result="procResult" timeout="5">
<cfdump var="#procResult#">
This should timeout after 5sec. Result (after ten seconds):

https://i2.paste.pics/e5c26300562465626458a27f6eb5941c.png

And all ten DB records inserted. Not sure what to put in the docs pull req here @Mark Drew (he/him). Got any more excellent suggestions 😛
Also if I take the timeout out, I get this:

https://i2.paste.pics/93f77526ffbf26c68407c99c8e2bfeff.png

Really. Nanoseconds? I presume this is coming from the DB though, so [shrug]
m
I looked at the source code but nothing jumps out on the behaviour. I would say lucee CANT kill the thread
a
I suspect it's cos the thread had already completed, cos it's not actually trying until after the proc completes?
m
Yeah, this is something you need FR to really see what happens.
a
I'll try on CF a bit later (tomorrow probably). I need to go drink beer now.
m
Cheers! I am going to go swat seagulls
a
Oooo-kay then. [just backs the fuck away from Mark who is clearly a lunatic these days]
m
... I decamped to Brighton for the summer... for context...
1
a
OK so more findings here. The above test was on MariaDB, and I tested it on MySQL this morning: same results. The timeout doesn't work on Lucee. As a control I performed the equiv test on CF, and it works exactly how I'd expect it to: a) the proc call times-out at 5sec b) it stops the proc running too, ie: it doesn't just "hang-up" on it, and leave the DB to finish in its own time. So I'm calling this a Lucee bug. Does that sound legit?