I'm running some code in R64 on a Mac OS 10.6.8 that calls a C program
through the dyn.load() function. The code hangs after several days of
computation, and I've having trouble locating the problem. Can anyone
decipher this info from the error report, and tell me if this is a problem
in R64, or in the C code? Thanks very much in advance.
A few hints: "pa" is the name of the C function in R, and
"polio_3A.so" is
the compiled code. I can post the R code or the C code if anyone needs to
see it, but my first priority is to figure out what this stack trace is
telling me.
Date/Time: 2012-02-03 10:35:57 -0500
OS Version: 10.6.8 (Build 10K549)
Architecture: x86_64
Report Version: 7
Command: R
Path: /Applications/R64.app/Contents/MacOS/R
Version: R 2.11.1 GUI 1.34 Leopard build 64-bit (5589)
Parent: launchd [95]
PID: 37306
Event: hang
Duration: 5.96s (sampling started after 2 seconds)
Steps: 19 (100ms sampling interval)
Pageins: 88
Pageouts: 0
Process: R [37306]
Path: /Applications/R64.app/Contents/MacOS/R
UID: 501
Thread eef8d9 DispatchQueue 1
User stack:
19 start + 52 (in R) [0x100001a74]
19 main + 844 (in R) [0x100001dec]
19 -[REngine runREPL] + 102 (in R) [0x100010f86]
19 run_REngineRmainloop + 192 (in R) [0x1000194a0]
19 R_ReplDLLdo1 + 462 (in libR.dylib) [0x10016ce4e]
19 Rf_eval + 1196 (in libR.dylib) [0x10013ca1c]
19 do_for + 678 (in libR.dylib) [0x100140f66]
19 Rf_eval + 1196 (in libR.dylib) [0x10013ca1c]
19 do_begin + 308 (in libR.dylib) [0x100141724]
19 Rf_eval + 1196 (in libR.dylib) [0x10013ca1c]
19 Rf_eval + 1196 (in libR.dylib) [0x10013ca1c]
19 do_begin + 308 (in libR.dylib) [0x100141724]
19 Rf_eval + 1196 (in libR.dylib) [0x10013ca1c]
19 do_while + 614 (in libR.dylib)
[0x10013dca6]
19 Rf_eval + 1196 (in libR.dylib)
[0x10013ca1c]
19 do_begin + 308 (in libR.dylib)
[0x100141724]
19 Rf_eval + 1196 (in libR.dylib)
[0x10013ca1c]
19 do_set + 709 (in libR.dylib)
[0x10013ea55]
19 Rf_eval + 962 (in libR.dylib)
[0x10013c932]
19 Rf_applyClosure + 724 (in
libR.dylib) [0x10013f364]
19 Rf_eval + 1196 (in
libR.dylib) [0x10013ca1c]
19 do_begin + 308 (in
libR.dylib) [0x100141724]
19 Rf_eval + 1196 (in
libR.dylib) [0x10013ca1c]
19 do_set + 709 (in
libR.dylib) [0x10013ea55]
19 Rf_eval + 1676 (in
libR.dylib) [0x10013cbfc]
19 do_dotCode + 6074
(in libR.dylib) [0x100111e9a]
6 pa + 2960
(polio_3A.c:258 in polio_3A.so) [0x101707b70]
5 pa + 2989
(polio_3A.c:256 in polio_3A.so) [0x101707b8d]
2 pa + 2964
(polio_3A.c:258 in polio_3A.so) [0x101707b74]
2 pa + 2969
(polio_3A.c:259 in polio_3A.so) [0x101707b79]
1 pa + 2966
(polio_3A.c:258 in polio_3A.so) [0x101707b76]
1 pa + 1035
(polio_3A.c:144 in polio_3A.so) [0x1017073eb]
1 R_ProcessEvents
+ 30 (in libR.dylib) [0x10021dc1e]
1
Re_ProcessEvents + 29 (in R) [0x10000f46d]
1 gettimeofday
+ 43 (in libSystem.B.dylib) [0x7fff82a0814f]
1
__gettimeofday + 80 (in commpage [libSystem.B.dylib]) [0x7fffffe00330]
1 pa + 1262
(polio_3A.c:165 in polio_3A.so) [0x1017074ce]
1 pa + 2975
(polio_3A.c:260 in polio_3A.so) [0x101707b7f]
--
View this message in context:
http://r.789695.n4.nabble.com/Hanging-please-help-decipher-event-report-tp4355128p4355128.html
Sent from the R help mailing list archive at Nabble.com.
On 03/02/2012 11:53 AM, jeremyd wrote:> I'm running some code in R64 on a Mac OS 10.6.8 that calls a C program > through the dyn.load() function. The code hangs after several days of > computation, and I've having trouble locating the problem. Can anyone > decipher this info from the error report, and tell me if this is a problem > in R64, or in the C code? Thanks very much in advance. > > A few hints: "pa" is the name of the C function in R, and "polio_3A.so" is > the compiled code. I can post the R code or the C code if anyone needs to > see it, but my first priority is to figure out what this stack trace is > telling me. > > Date/Time: 2012-02-03 10:35:57 -0500 > OS Version: 10.6.8 (Build 10K549) > Architecture: x86_64 > Report Version: 7 > > Command: R > Path: /Applications/R64.app/Contents/MacOS/R > Version: R 2.11.1 GUI 1.34 Leopard build 64-bit (5589) > Parent: launchd [95] > > PID: 37306 > Event: hang > Duration: 5.96s (sampling started after 2 seconds) > Steps: 19 (100ms sampling interval) > > Pageins: 88 > Pageouts: 0 > > > Process: R [37306] > Path: /Applications/R64.app/Contents/MacOS/R > UID: 501 > > Thread eef8d9 DispatchQueue 1 > User stack: > 19 start + 52 (in R) [0x100001a74] > 19 main + 844 (in R) [0x100001dec] > 19 -[REngine runREPL] + 102 (in R) [0x100010f86] > 19 run_REngineRmainloop + 192 (in R) [0x1000194a0] > 19 R_ReplDLLdo1 + 462 (in libR.dylib) [0x10016ce4e] > 19 Rf_eval + 1196 (in libR.dylib) [0x10013ca1c] > 19 do_for + 678 (in libR.dylib) [0x100140f66] > 19 Rf_eval + 1196 (in libR.dylib) [0x10013ca1c] > 19 do_begin + 308 (in libR.dylib) [0x100141724] > 19 Rf_eval + 1196 (in libR.dylib) [0x10013ca1c] > 19 Rf_eval + 1196 (in libR.dylib) [0x10013ca1c] > 19 do_begin + 308 (in libR.dylib) [0x100141724] > 19 Rf_eval + 1196 (in libR.dylib) [0x10013ca1c] > 19 do_while + 614 (in libR.dylib) > [0x10013dca6] > 19 Rf_eval + 1196 (in libR.dylib) > [0x10013ca1c] > 19 do_begin + 308 (in libR.dylib) > [0x100141724] > 19 Rf_eval + 1196 (in libR.dylib) > [0x10013ca1c] > 19 do_set + 709 (in libR.dylib) > [0x10013ea55] > 19 Rf_eval + 962 (in libR.dylib) > [0x10013c932] > 19 Rf_applyClosure + 724 (in > libR.dylib) [0x10013f364] > 19 Rf_eval + 1196 (in > libR.dylib) [0x10013ca1c] > 19 do_begin + 308 (in > libR.dylib) [0x100141724] > 19 Rf_eval + 1196 (in > libR.dylib) [0x10013ca1c] > 19 do_set + 709 (in > libR.dylib) [0x10013ea55] > 19 Rf_eval + 1676 (in > libR.dylib) [0x10013cbfc]Down to here is normal stuff R will show when evaluating a complex expression.> 19 do_dotCode + 6074 > (in libR.dylib) [0x100111e9a]This is where we leave R and enter your code.> 6 pa + 2960 > (polio_3A.c:258 in polio_3A.so) [0x101707b70]Presumably polio_3A.c line 258 is meaningful to you. It's where your code called some other function in your code, and there were some nested calls...> 5 pa + 2989 > (polio_3A.c:256 in polio_3A.so) [0x101707b8d] > 2 pa + 2964 > (polio_3A.c:258 in polio_3A.so) [0x101707b74] > 2 pa + 2969 > (polio_3A.c:259 in polio_3A.so) [0x101707b79] > 1 pa + 2966 > (polio_3A.c:258 in polio_3A.so) [0x101707b76] > 1 pa + 1035 > (polio_3A.c:144 in polio_3A.so) [0x1017073eb]... down to here, on line 144 of the same file, where you decided to let R process some events.> 1 R_ProcessEvents > + 30 (in libR.dylib) [0x10021dc1e] > 1 > Re_ProcessEvents + 29 (in R) [0x10000f46d] > 1 gettimeofday > + 43 (in libSystem.B.dylib) [0x7fff82a0814f] > 1 > __gettimeofday + 80 (in commpage [libSystem.B.dylib]) [0x7fffffe00330] > 1 pa + 1262 > (polio_3A.c:165 in polio_3A.so) [0x1017074ce] > 1 pa + 2975 > (polio_3A.c:260 in polio_3A.so) [0x101707b7f] >and it looks as though one of those events called something in your code near line 165 then line 260. Are you setting up signal handlers? Duncan Murdoch> -- > View this message in context: http://r.789695.n4.nabble.com/Hanging-please-help-decipher-event-report-tp4355128p4355128.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Thanks for your reply. At line 144 I call R_CheckUserInterrupt(). I added this because otherwise, R would not respond to the user for thing like switching over to the window until the C code exited back to R. I then moved that command into a loop where it should occur quite frequently, because I thought this would fix my hanging problem. I admit that I may be using this command in an inefficient or flat-out wrong way, as this is my first foray into R/C cooperation. I should add that I cannot get the C code to hang or produce any errors when I run it on its own. I would appreciate any additional thoughts or questions. -- View this message in context: http://r.789695.n4.nabble.com/Hanging-please-help-decipher-event-report-tp4355128p4355709.html Sent from the R help mailing list archive at Nabble.com.