tada / pljava

PL/Java is a free add-on module that brings Java™ Stored Procedures, Triggers, Functions, Aggregates, Operators, Types, etc., to the PostgreSQL™ backend.
http://tada.github.io/pljava/
Other
238 stars 77 forks source link

The timer in _destroyJavaVM does not take effect #407

Closed sincatter closed 1 year ago

sincatter commented 2 years ago
#if PG_VERSION_NUM >= 90300
        tid = RegisterTimeout(USER_TIMEOUT, terminationTimeoutHandler);
#else
        saveSigAlrm = pqsignal(SIGALRM, terminationTimeoutHandler);
        enable_sig_alarm(5000, false);
#endif

        elog(DEBUG2, "shutting down the Java virtual machine");
        JNI_destroyVM(s_javaVM);

#if PG_VERSION_NUM >= 90300
        disable_timeout(tid, false);
#else
        disable_sig_alarm(false);
        pqsignal(SIGALRM, saveSigAlrm);
#endif

static void _destroyJavaVM(int status, Datum dummy)

Hi~ Why is enable_timeout_after(tid, 5000) not used when PG_VERSION_NUM >= 90300, like when PG_VERSION_NUM < 90300.

I think when PG_VERSION_NUM >= 90300, The timer does not really take effect.

jcflack commented 2 years ago

On 2022-06-18 06:16, sincatter wrote:


#if PG_VERSION_NUM >= 90300
      tid = RegisterTimeout(...
#else
      saveSigAlrm = pqsignal(...
      enable_sig_alarm(...
#endif
Why is enable_timeout_after(tid, 5000) not used when PG_VERSION_NUM >=
90300, like when PG_VERSION_NUM < 90300.

I think when PG_VERSION_NUM >= 90300, The timer does not really take 
effect.

Hi,

I'm traveling at the moment, but the usual reason when such conditional code appears in PL/Java is a change of available API in Postgres, such as a newly-added RegisterTimeout call. Of course, it could be a bug if that call is being used improperly, or something else could be going wrong (if you are seeing something go wrong).

Regards, -Chap

jcflack commented 1 year ago

Believed resolved in 1.6.5.