From thomas.friedrichsmeier at ruhr-uni-bochum.de  Mon Apr 17 15:20:46 2006
From: thomas.friedrichsmeier at ruhr-uni-bochum.de (Thomas Friedrichsmeier)
Date: Mon, 17 Apr 2006 15:20:46 +0200
Subject: [Rd] Stack checking, core dumps, and embedding R
In-Reply-To: <200604170334.14003.thomas.friedrichsmeier@ruhr-uni-bochum.de>
References: <200604170334.14003.thomas.friedrichsmeier@ruhr-uni-bochum.de>
Message-ID: <200604171520.51565.thomas.friedrichsmeier@ruhr-uni-bochum.de>

Excuse me please, for being impatient, but I'm worried this issue may not be 
considered important enough to be fixed in R 2.3.0 at this late point of 
time. So let me re-state this:

In the current state, R will *not work at all* when run in a thread on linux.

I do not know how many embedding applications run R in a separate thread, and 
are affected by this. I know that at least rkward does, and it will not run.

Reconsidering the proposals I made yesterday, after some sleep, let me propose 
this corrected fix (insert into src/unix/system.c, at line 179, right 
above "if(R_CStackStart == -1) R_CStackLimit = -1; /* never set */"):

    if (abs (R_CStackStart - (uintptr_t) &i) > 20000) {
	/* Very unlikely we're this far away from the stack start at this
	point in the code. Disable checking */
	R_CStackStart = -1;
    }

For all I care, set the safety margin to 50000 or even more. This heuristic is 
only meant to catch cases where the detected value for R_CStackStart is 
*obviously wrong*, most importantly in case of threads.

In this case all it will do is to disable the check. I can see no other 
side-effect.

Once again, excuse me for being impatient, but *please* consider this for 
inclusion in R 2.3.0.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20060417/b45bd4b3/attachment.bin 


[Rd] Stack checking, core dumps, and embedding R
Thomas Friedrichsmeier