<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Cornelius,<br>
<br>
I will check further, but I don't think that patch is correct. <br>
<br>
I will e-mail when I have finished investigating/updating.<br>
<br>
John<br>
<br>
On 14/01/14 12:32, Cornelius Riemenschneider wrote:<br>
</div>
<blockquote
cite="mid:zarafa.52d52e77.0e0d.22d50c0c1289aff7@noriswww"
type="cite">
<meta http-equiv="Context-Type" content="text/html;
charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered
medium)">
<div class="WordSection1">
<p class="MsoNormal"><span>Hello John,</span></p>
<p class="MsoNormal"><span>I finally made it to test your fix.</span></p>
<p class="MsoNormal"><span>I also modified callCbc with the
attached patch, because the framework we use to drive cbc
uses callCbc.</span></p>
<p class="MsoNormal"><span>I now get a crash in
ClpPackedMatrix::scale, with the following backtrace (only
relevant lines included)</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>#4 0x00007f51494f5460 in
JVM_handle_linux_signal (sig=11, info=0x7f510c9ff8f0,
ucVoid=0x7f510c9ff7c0, </span></p>
<p class="MsoNormal"><span> abort_if_unrecognized=1)</span></p>
<p class="MsoNormal"><span> at
/home/jmm/jdk/openjdk-6-6b27-1.12.6/build/openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp:528</span></p>
<p class="MsoNormal"><span>#5 <signal handler called></span></p>
<p class="MsoNormal"><span>#6 __memset_sse2 () at
../sysdeps/x86_64/multiarch/../memset.S:387</span></p>
<p class="MsoNormal"><span>#7 0x00007f50fb5d428a in
ClpPackedMatrix::scale(ClpModel*, ClpSimplex const*) const
()</span></p>
<p class="MsoNormal"><span> from
/srv/itscope/liferay/jetty-7.5.4/work/jetty-0.0.0.0-8081-itscopeserver-portlet-_itscopeserver-portlet-any-/eclipse/configuration/org.eclipse.osgi/bundles/6/1/.cp/libjnilinearsolver.so</span></p>
<p class="MsoNormal"><span>#8 0x00007f50fb599809 in
OsiClpSolverInterface::setSpecialOptions(unsigned int) ()</span></p>
<p class="MsoNormal"><span> from
/srv/itscope/liferay/jetty-7.5.4/work/jetty-0.0.0.0-8081-itscopeserver-portlet-_itscopeserver-portlet-any-/eclipse/configuration/org.eclipse.osgi/bundles/6/1/.cp/libjnilinearsolver.so</span></p>
<p class="MsoNormal"><span>#9 0x00007f50fb3b5264 in
CbcMain1(int, char const**, CbcModel&, int
(*)(CbcModel*, int), CbcSolverUsefulData&)</span></p>
<p class="MsoNormal"><span> ()</span></p>
<p class="MsoNormal"><span> from
/srv/itscope/liferay/jetty-7.5.4/work/jetty-0.0.0.0-8081-itscopeserver-portlet-_itscopeserver-portlet-any-/eclipse/configuration/org.eclipse.osgi/bundles/6/1/.cp/libjnilinearsolver.so</span></p>
<p class="MsoNormal"><span>#10 0x00007f50fb3d14a7 in
callCbc1(char const*, CbcModel&, int (*)(CbcModel*,
int)) ()</span></p>
<p class="MsoNormal"><span> from
/srv/itscope/liferay/jetty-7.5.4/work/jetty-0.0.0.0-8081-itscopeserver-portlet-_itscopeserver-portlet-any-/eclipse/configuration/org.eclipse.osgi/bundles/6/1/.cp/libjnilinearsolver.so</span></p>
<p class="MsoNormal"><span>#11 0x00007f50fb3d1b54 in
callCbc(char const*, CbcModel&) ()</span></p>
<p class="MsoNormal"><span> from
/srv/itscope/liferay/jetty-7.5.4/work/jetty-0.0.0.0-8081-itscopeserver-portlet-_itscopeserver-portlet-any-/eclipse/configuration/org.eclipse.osgi/bundles/6/1/.cp/libjnilinearsolver.so</span></p>
<p class="MsoNormal"><span>#12 0x00007f50fb39c320 in
operations_research::CBCInterface::Solve
(this=0x7f511c0a5fe0, param=...)</span></p>
<p class="MsoNormal"><span> at
src/linear_solver/cbc_interface.cc:378</span></p>
<p class="MsoNormal"><span>#13 0x00007f50fb36d2e2 in
operations_research::MPSolver::Solve (this=0x7f511f4dadf0,
param=...)</span></p>
<p class="MsoNormal"><span> at
src/linear_solver/linear_solver.cc:973</span></p>
<p class="MsoNormal"><span>#14 0x00007f50fb36d25f in
operations_research::MPSolver::Solve (this=0x7f511f4dadf0)</span></p>
<p class="MsoNormal"><span> at
src/linear_solver/linear_solver.cc:961</span></p>
<p class="MsoNormal"><span>#15 0x00007f50fb366c6f in
Java_com_google_ortools_linearsolver_mainJNI_MPSolver_1solve_1_1SWIG_10
()</span></p>
<p class="MsoNormal"><span> from
/srv/itscope/liferay/jetty-7.5.4/work/jetty-0.0.0.0-8081-itscopeserver-portlet-_itscopeserver-portlet-any-/eclipse/configuration/org.eclipse.osgi/bundles/6/1/.cp/libjnilinearsolver.so</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>Do you have any idea about the crash?</span></p>
<p class="MsoNormal"><span>If not, where should I start
debugging the issue?</span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"><span>Regards,</span></p>
<div>
<p class="MsoNormal"><span>Cornelius Riemenschneider</span></p>
<p class="MsoNormal"><span>--</span></p>
<p class="MsoNormal"><span>ITscope GmbH</span></p>
<p class="MsoNormal"><span>Ludwig-Erhard-Allee 20</span></p>
<p class="MsoNormal"><span>76131 Karlsruhe</span></p>
<p class="MsoNormal"><span>Email:
<a class="moz-txt-link-abbreviated" href="mailto:cornelius.riemenschneider@itscope.de">cornelius.riemenschneider@itscope.de</a></span></p>
<p class="MsoNormal"><span><a class="moz-txt-link-freetext" href="https://www.itscope.com">https://www.itscope.com</a></span></p>
<p class="MsoNormal"><span>Handelsregister: AG Mannheim, HRB
232782</span></p>
<p class="MsoNormal"><span>Sitz der Gesellschaft: Karlsruhe</span></p>
<p class="MsoNormal"><span>Geschäftsführer: Alexander Münkel,
Benjamin Mund, Stefan Reger</span></p>
</div>
<p class="MsoNormal"><span> </span></p>
<div>
<div>
<p class="MsoNormal"><b><span>Von:</span></b><span>
<a class="moz-txt-link-abbreviated" href="mailto:john.forrest@fastercoin.com">john.forrest@fastercoin.com</a>
[<a class="moz-txt-link-freetext" href="mailto:cbc-bounces@list.coin-or.org">mailto:cbc-bounces@list.coin-or.org</a>] <b>Im Auftrag von
</b>John Forrest<br>
<b>Gesendet:</b> Mittwoch, 18. Dezember 2013 14:23<br>
<b>An:</b> <a class="moz-txt-link-abbreviated" href="mailto:cbc@list.coin-or.org">cbc@list.coin-or.org</a><br>
<b>Betreff:</b> Re: [Cbc] Threadsafe usage of Cbc</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">Cornelius,<br>
<br>
I have made some changes, which I hope will be enough for
you. I have done the minimum amount of work.<br>
<br>
I don't think they can hurt anyone but as Ted Ralphs is
preparing a new release, I will delay updating
Cbc/stable/CbcSolver.?pp for a day or two. If anyone wants
to test the code I attach CbcSolver.?pp.<br>
<br>
You need to compile with -DCBC_THREAD_SAFE. The main thing
this does is that Cbc only reads argv/argc type parameters
in a crude threadsafe way. You also need to use alternative
versions of CbcMain0/1.<br>
<br>
parallel.cpp has been added to Cbc/examples which is a
simple example.<br>
<br>
Please tell me if there are any problems. Some lesser used
Cgl cut generators may not be threadsafe, but I think the
commonly used ones are.<br>
<br>
John Forrest<br>
<br>
<br>
On 17/12/13 15:11, Cornelius Riemenschneider wrote:</p>
</div>
<blockquote>
<div>
<p class="MsoNormal">Hello,</p>
<p class="MsoNormal">we use CBC via googles or-tools from
java in our application.</p>
<p class="MsoNormal">Compared to scientific problems, our
problems are small and solved by Cbc in <1s (which is
great!).</p>
<p class="MsoNormal">As we process requests from users
concurrently, we’d also like to call Cbc concurrently.</p>
<p class="MsoNormal">Currently, this is impossible, because
Cbc uses the static parameters array in CbcMain0 and
CbcMain1 and thus crashes or reads incorrect parameters.</p>
<p class="MsoNormal">One backtrace, for example is:</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">#2 0x00007fb3435bf52b in __libc_message
(do_abort=<optimized out>, fmt=<optimized
out>) at ../sysdeps/unix/sysv/linux/libc_fatal.c:189<br>
#3 0x00007fb3435c8d76 in malloc_printerr (action=3,
str=0x7fb3436a1248 "double free or corruption (!prev)",
ptr=<optimized out>) at malloc.c:6283<br>
#4 0x00007fb3435cdaac in *__GI___libc_free
(mem=<optimized out>) at malloc.c:3738<br>
#5 0x00007fb342733f06 in std::string::assign(std::string
const&) () from
/usr/lib/x86_64-linux-gnu/libstdc++.so.6<br>
#6 0x00007fb2d652cb7b in establishParams(int&,
CbcOrClpParam*) () from libjnilinearsolver.so<br>
#7 0x00007fb2d64edc3b in CbcMain0(CbcModel&) () from
libjnilinearsolver.so<br>
#8 0x00007fb2d6511bec in callCbc(char const*,
CbcModel&) () from libjnilinearsolver.so<br>
#9 0x00007fb2d64e3fce in
operations_research::CBCInterface::Solve(operations_research::MPSolverParameters
const&) () from libjnilinearsolver.so<br>
#10 0x00007fb2d64cfe45 in
operations_research::MPSolver::Solve(operations_research::MPSolverParameters
const&) () from libjnilinearsolver.so<br>
#11 0x00007fb2d64cff3b in
operations_research::MPSolver::Solve() () from
libjnilinearsolver.so<br>
#12 0x00007fb2d64c91cf in
Java_com_google_ortools_linearsolver_mainJNI_MPSolver_1solve_1_1SWIG_10
() from libjnilinearsolver.so</p>
<p class="MsoNormal"># from here on it’s just the JVM</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">As I don’t know the code and it’s hard
to read, I can’t really fix the problem by myself,</p>
<p class="MsoNormal">but wouldn’t it be better to move
parameters inside CbcModel instead of having a static
array laying around?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Andi f that’s done (or another solution
is found), do you know of any thread-safety issues in cbc?</p>
<p class="MsoNormal">Keep in mind, we don’t want Cbc to
solve our problem in multiple threads, we just want to be
able to solve different problems simultaneous.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Regards,</p>
<p class="MsoNormal">Cornelius Riemenschneider</p>
<p class="MsoNormal">--</p>
<p class="MsoNormal">ITscope GmbH</p>
<p class="MsoNormal">Ludwig-Erhard-Allee 20</p>
<p class="MsoNormal">76131 Karlsruhe</p>
<p class="MsoNormal">Email: <a moz-do-not-send="true"
href="mailto:cornelius.riemenschneider@itscope.de">cornelius.riemenschneider@itscope.de</a></p>
<p class="MsoNormal"><a moz-do-not-send="true"
href="https://www.itscope.com">https://www.itscope.com</a></p>
<p class="MsoNormal">Handelsregister: AG Mannheim, HRB
232782</p>
<p class="MsoNormal">Sitz der Gesellschaft: Karlsruhe</p>
<p class="MsoNormal">Geschäftsführer: Alexander Münkel,
Benjamin Mund, Stefan Reger</p>
<p class="MsoNormal"> </p>
</div>
<p class="MsoNormal"><br>
<br>
<br>
</p>
<pre>_______________________________________________</pre>
<pre>Cbc mailing list</pre>
<pre><a moz-do-not-send="true" href="mailto:Cbc@list.coin-or.org">Cbc@list.coin-or.org</a></pre>
<pre><a moz-do-not-send="true" href="http://list.coin-or.org/mailman/listinfo/cbc">http://list.coin-or.org/mailman/listinfo/cbc</a></pre>
</blockquote>
<p class="MsoNormal"> </p>
</div>
</blockquote>
<br>
</body>
</html>