Re: Pike 8.0: Sql.pgsql objects don't get garbage collected?

Henrik Grubbström <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Organization Roxen Internet Software AB
Message-ID <[email protected]>
On Thu, 25 Feb 2016, Stephen R. van den Berg wrote:

> Henrik Grubbstr?m wrote:
>> Hmm... I suspect that the above is due to cast_to_program() et al in
>> the master object not being thread safe, in which case a thread may
>> find and attempt to clone a program which still is being compiled in
>> a different thread. This wasn't a problem in Pike 7.8 and earlier, as
>> then all other threads were halted while the compiler was running.
>
> Quite likely, yes.
> A quick fix would be to put a Mutex around the compiler so that
> we'd have at most one compilerthread running at any time.

There's already such a mutex, the problem (as hypothesized) is that eg 
the cache in master()->programs contains partially compiled programs 
(as these are needed by the compiler), which can be picked up by other 
threads before they have finished compiling. Some way to detect whether 
the current thread is invoked via the compiler or not is probably needded.

BTW: A potential work around for the problem is to make sure that the 
program has been compiled before the Sql.Sql program attempts to load it:

   Simply add the line

     Sql.pgsql force_compile_pgsql_kludge;

   somewhere in the test program.

-- 
Henrik Grubbström					[email protected]
Roxen Internet Software AB
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.