Hi,

I'm Yash, currently working on the PostgreSQL plv8 extension, which
integrates the V8 JavaScript engine. During one of the regression tests
[1], the following query results in an error and causes the process to hang
indefinitely:

SELECT caller(10, 3);

ERROR:  javascript function is not found for "sqlf"
CONTEXT:  caller() LINE 8:     func = plv8.find_function("sqlf");

While debugging the V8 engine, I made the following observations:

   1.

   In VisitStack() (isolate.cc), the following loop hangs:

   for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {

   2.

   Diving deeper, inside StackFrameIterator::Advance() (frames.cc [2]), the
   loop:

   while (!it.done()) { it.Advance(); }

   gets stuck because of this line:

   handler_ = handler_->next();

   It appears that handler_->next() is pointing back to handler_ itself,
   creating a cycle and causing an infinite loop.

Could someone help me understand why handler_->next() could end up pointing
to itself, instead of being nullptr? I'm trying to trace the root cause of
this corrupted/cyclic stack handler state.

Any guidance on how to further debug this would be appreciated.

References:-

[1] https://github.com/plv8/plv8/blob/r3.2/sql/plv8.sql#L403

[2] https://github.com/v8/v8/blob/main/src/execution/frames.cc#L119

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/v8-dev/CANvvV1p7D7OgdcakPbnuBwQ36QfHpxOX3TYxZagkYDzgxp0F4g%40mail.gmail.com.

Reply via email to