Problems with ORACLE ProC and multi-threading

From: Alf E. Helseth <nomail_at_nowhere.com>
Date: Tue, 05 Mar 2002 09:23:05 GMT
Message-ID: <3C848E78.772525B_at_nowhere.com>



Hi!

We are running programs on IBM AIX 4.3.3 based on C/C++ code compiled with Pro*C v 8.1.7.

We experience problems resulting in that multi-threaded programs crash
("Segmentation fault (core dumped))" if the length of a SQL-statement
exceeds the value of "MAXLITERAL" in Pro*C.

The MAXLITERAL value restricts the length on char* strings sendt to the compiler, and has a default- (and max-) value of 1024. If a SQL-statements exceeds this limit it is divided at compile time, and concatenated at runtime before execution. This last operation seems not to be thread-safe. We compile (of course) with parameter THREADS=YES for Pro*C, define -D_THREAD_SAFE for the compiler, and link with -lpthreads. We have been testing somewhat thorough around this, and feel rather safe that this is the problem. Long statements (>1024) in one thread runs OK, and so does shorter statements in multi-threading. I have tried to change the C-code generated by Pro*C to NOT do the dividing even if exceeding 1024, and then the program runs OK. Have also been changing
(decreasing) the value for MAXLITERAL on the command line to Pro*C, to
force dividing of shorter statements, and this also results in crash.

Have anyone been experiencing this problem or know of a workaround for it?

-Alf Received on Tue Mar 05 2002 - 10:23:05 CET

Original text of this message