Discussion:
[Rcpp-devel] Debug RInside crash
Jose
2017-12-13 13:51:38 UTC
Permalink
Hello,

I am invoking some R code using RInside from a
C++ tool. Every time I invoke the code it crashes
randomly. Sometimes even with the same data. It never
crashes when I use R directly.

I am invoking this function DESeq2::DESeq(data) which runs
a set of statistical operaions. It always crashes (when it does)
at this point "mean-dispersion relationship" and the system's log
shows that it always crashes at the same point:

Thread 3 Crashed:: Thread (pooled)
0 locfit.so 0x00000001229b4b34 atree_grow + 20
(ev_atree.c:92)
1 locfit.so 0x00000001229b4d06 atree_grow + 486
(ev_atree.c:124)
2 locfit.so 0x00000001229b4d06 atree_grow + 486
(ev_atree.c:124)
3 locfit.so 0x00000001229b4d06 atree_grow + 486
(ev_atree.c:124)
4 locfit.so 0x00000001229b5259 atree_start + 1033
(ev_atree.c:167)
5 locfit.so 0x00000001229e384d startlf + 1053
(startlf.c:160)
6 locfit.so 0x00000001229a7147 slocfit + 1335
(S_enter.c:301)
7 libR.dylib 0x000000010d0ebcd5 do_dotCode + 5973
8 libR.dylib 0x000000010d1183d9 Rf_eval + 1657
(eval.c:728)

locfit seems to be the R library for local regression fit.

Is there something that I can do to overcome this issue? Why would this
happen
if it never happens when I invoke DESeq from R directly?.

Thanks for the help.

Best,
Jose
Dirk Eddelbuettel
2017-12-13 14:31:50 UTC
Permalink
On 13 December 2017 at 14:51, Jose wrote:
| Hello,
|
| I am invoking some R code using RInside from a
| C++ tool. Every time I invoke the code it crashes
| randomly. Sometimes even with the same data. It never
| crashes when I use R directly.
|
| I am invoking this function DESeq2::DESeq(data) which runs
| a set of statistical operaions. It always crashes (when it does)
| at this point "mean-dispersion relationship" and the system's log
| shows that it always crashes at the same point:
|
| Thread 3 Crashed:: Thread (pooled)
| 0 locfit.so 0x00000001229b4b34 atree_grow + 20
| (ev_atree.c:92)
| 1 locfit.so 0x00000001229b4d06 atree_grow + 486
| (ev_atree.c:124)
| 2 locfit.so 0x00000001229b4d06 atree_grow + 486
| (ev_atree.c:124)
| 3 locfit.so 0x00000001229b4d06 atree_grow + 486
| (ev_atree.c:124)
| 4 locfit.so 0x00000001229b5259 atree_start + 1033
| (ev_atree.c:167)
| 5 locfit.so 0x00000001229e384d startlf + 1053
| (startlf.c:160)
| 6 locfit.so 0x00000001229a7147 slocfit + 1335
| (S_enter.c:301)
| 7 libR.dylib 0x000000010d0ebcd5 do_dotCode + 5973
| 8 libR.dylib 0x000000010d1183d9 Rf_eval + 1657
| (eval.c:728)
|
| locfit seems to be the R library for local regression fit.
|
| Is there something that I can do to overcome this issue?

Create smaller and smaller example that this exhibit the issue?

| Why would this happen if it never happens when I invoke DESeq from R
| directly?.

Maybe locfit does something it is not supposed to do like threading?

Dirk

| Thanks for the help.
|
| Best,
| Jose
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-***@lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Jose
2017-12-13 16:30:10 UTC
Permalink
Unfortunately, I have not been able to find any common pattern.
I run it 10 times with the same dataset and It would crash only sometimes.

There's gotta be a race condition most likely related to threading as you
said.

I explicitly tell DESeq to not use multi-threading though but I believe that
doesn't necessarily affect locfit.

Anyways, by digging into DESeq's R code I am able to avoid the potentially
race conditioned part by using a simpler fitting parameter.

So, the behaviour of RInside may be undefined if the R library does
threading?

Thanks for help!

Best,
Jose
Post by Dirk Eddelbuettel
| Hello,
|
| I am invoking some R code using RInside from a
| C++ tool. Every time I invoke the code it crashes
| randomly. Sometimes even with the same data. It never
| crashes when I use R directly.
|
| I am invoking this function DESeq2::DESeq(data) which runs
| a set of statistical operaions. It always crashes (when it does)
| at this point "mean-dispersion relationship" and the system's log
|
| Thread 3 Crashed:: Thread (pooled)
| 0 locfit.so 0x00000001229b4b34 atree_grow + 20
| (ev_atree.c:92)
| 1 locfit.so 0x00000001229b4d06 atree_grow + 486
| (ev_atree.c:124)
| 2 locfit.so 0x00000001229b4d06 atree_grow + 486
| (ev_atree.c:124)
| 3 locfit.so 0x00000001229b4d06 atree_grow + 486
| (ev_atree.c:124)
| 4 locfit.so 0x00000001229b5259 atree_start + 1033
| (ev_atree.c:167)
| 5 locfit.so 0x00000001229e384d startlf + 1053
| (startlf.c:160)
| 6 locfit.so 0x00000001229a7147 slocfit + 1335
| (S_enter.c:301)
| 7 libR.dylib 0x000000010d0ebcd5 do_dotCode + 5973
| 8 libR.dylib 0x000000010d1183d9 Rf_eval + 1657
| (eval.c:728)
|
| locfit seems to be the R library for local regression fit.
|
| Is there something that I can do to overcome this issue?
Create smaller and smaller example that this exhibit the issue?
| Why would this happen if it never happens when I invoke DESeq from R
| directly?.
Maybe locfit does something it is not supposed to do like threading?
Dirk
| Thanks for the help.
|
| Best,
| Jose
| _______________________________________________
| Rcpp-devel mailing list
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
Dirk Eddelbuettel
2017-12-13 16:54:09 UTC
Permalink
On 13 December 2017 at 17:30, Jose wrote:
| So, the behaviour of RInside may be undefined if the R library does
| threading?

As is all (embedded) R code (!!), and that is well documented.

So "maybe" all you need is a mutex. We can't tell without code.

Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | ***@debian.org
Loading...