<div dir="ltr">I narrowed the problem down to the call to R_ReplDLLdo1() in RInside, and I built<div>R-4.3.0 pre-release version for Windows from source to investigate further (online</div><div>instructions by Tomas Kalibera were very helpful).</div><div><br></div><div>But the problem does not occur with this version of R! Note that the problem</div><div>did not occur in some older versions of R either.</div><div><div><br></div><div>This version-dependence may be related to the fact that this function and others</div><div>used by Rcpp/RInside are not part of the supported API for R, so the underlying</div><div>implementation details for internals like external pointers may change.</div><div><br></div><div>Dominick</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 17, 2023 at 9:35 PM Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Hi Dominick,<br>
<br>
First reflex: uh-oh as 'Rcpp_precious_remove' created some headaches for some<br>
people when mixing Rcpp and packages built with Rcpp but not the current one.<br>
We think all this got squared away an Rcpp release or two ago so as a first<br>
step please make sure _all_ involved packaes are current with CRAN and<br>
rebuilt.<br>
<br>
On 17 January 2023 at 21:15, Dominick Samperi wrote:<br>
| I think I found a problem under Windows with the repl code from RInside.<br>
| The problem appears if I simply compile the code in<br>
| RInside/inst/examples/standard using the Makefile.win there,<br>
| after a few hacks to deal with spaces in file names and the direction of<br>
| slashes.<br>
<br>
(A small and focused PR would be appreciated if there is some cleanup needed).<br>
<br>
| The problem appears with the example rinside_interactive0.cpp, but to keep<br>
| things simple I've stripped out just the repl code into repl.cpp. It is<br>
| attached, along with a Makefile that works under Windows, with g++ from<br>
| Rtool42, specifically,<br>
| <br>
| set PATH=c:\Rtools42\x86_64-w64-mingw32.static.posic\bin;%PATH%<br>
| <br>
| When repl.exe is run an extra window pops up, and there are random<br>
| terminations, and sometimes a crash, especially if you try to plot<br>
| something. The program immediately terminates after plotting.<br>
| <br>
| None of this happens under Linux (Ubuntu), where the program works as<br>
| expected.<br>
<br>
Yes it built for me. And runs fine (under Ubuntu 22.10). I don't have Windows<br>
around. <br>
<br>
| I tried installing gdb using 'pacman -Sy gdb' (following CRAN docs), and<br>
| there were no apparent problems, but some of the DLL's had the wrong<br>
| version, and gdb could not be started. (Missing DLL's were msys-ffi-8.dll<br>
| and msys-unistring-5.dll.)<br>
<br>
I wonder if instead of / in addition to gdb you could instrument your windows<br>
binary to log copiously?<br>
<br>
| I was able to build using Visual Studio, and in that case the app crashes<br>
| immediately with a complaint about Rcpp_precious_remove. But here I could<br>
| bring up a debugger and step trough code, and sure enough it crashes soon<br>
| after the call<br>
| GET_CALLABLE("Rcpp_precious_remove"). Stepping into this function leads to<br>
| Microsoft code in thread_safe_statics.cpp that implements a critical<br>
| section, suggesting<br>
| that more than one thread is started.<br>
| <br>
| I wonder if the problem is related to the fact that R is not thread safe?<br>
<br>
That would bite Linux as well as Windows.<br>
<br>
| Or could it be that the preserved objects are bigger under Windows?<br>
<br>
I don't see how because relative to machine memory these objects are<br>
still tiny,<br>
<br>
| I'm working with Rcpp_1.0.9 and RInside_0.2.17, with R-4.2.2.<br>
<br>
All good. Maybe rebuild RInside under that Rcpp just to be sure.<br>
<br>
Cheers, Dirk<br>
<br>
| <br>
| Thanks,<br>
| Dominick<br>
| x[DELETED ATTACHMENT repl.cpp, plain text]<br>
| x[DELETED ATTACHMENT Makefile, Untyped binary data]<br>
| _______________________________________________<br>
| Rcpp-devel mailing list<br>
| <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
-- <br>
<a href="http://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
</blockquote></div>