New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R crashes under Windows 10 #179
Comments
Same example code results in the same crash on a Windows workstation. Intel Xeon E31235, 24GB RAM. NVIDIA Quadro K2000. Version informationHere is the output from sessionInfo() in my R session:
I have a few busy days until the weekend. I will try to have a closer look at the code during the coming weekend. This example gives at least a 'reprex' for what I informally mentioned a few days ago in a comment. |
Oh no! Sorry for the crashes. I am surprised, because CRAN reports that Windows is OK: CRAN Package Check Results for Package ggrepel
|
CRAN reports that building vignette examples on Windows is OKThis is puzzling, and makes me wonder about your system configuration ... You're reporting that this example from the In the CRAN Windows log, we can see that building the vignette seems to work:
ASAN can find bugs that crash RIn this past, I fixed a heap buffer overflow that was detected when CRAN reported the output from ASAN: cad83bb It is possible that running address sanitizer (ASAN) might help to discover which lines are causing the problem on your system. Here is a blog post about that: https://knausb.github.io/2017/06/validating-asan/ Consider running ASAN on your machineHere is the way I recommend you try running ASAN on your machine. Brodie Gaslam shared these steps with me in the past, and it worked for me: Downlod Winston Chang's r-debug docker container on my OS X macbook: https://hub.docker.com/r/wch1/r-debug/ Here are the steps I followed:
|
Hi, The unedited example from the vignette does not crash in either of my computers. My example code for reproducing the crash is modified from that in the package documentation to use the whole of The 'ggrepel' package does pass check --as-cran on my own laptop. This agrees with your experience. The crash appears only in some cases, and with large data sets for which there are no examples or tests in the package. I first noticed the problem when trying to build the vignette for my own package 'ggspectra'. It is odd that 'ggspectra' passes its tests on CRAN, but I do not really know if the daily checks on CRAN rebuild the vignettes or not. If my example code does not fail under other operating systems, the problem maybe elsewhere. I will install an earlier version of 'ggrepel' to make sure that this is not an old problem, or a problem triggered by something different in my both of my own computers. (I should set up continuous integration in Github for my packages... as you have done for 'ggrepel'.) I will also try to see if the problem is not coming from Windows, Rcpp or RTools updates. Best wishes, Pedro. |
I have an RStudio Cloud account but I did not think earlier of using it for testing... I can confirm that there is no crash under Ubuntu, just a figure being rendered quickly, but with several overlapping labels. This is in an instance with rather little RAM at 1GB, and this RAM is reported as far from being fully in use. I need to explore how to use ASAN under Windows with the gnu compilers (everything is quite a patch under Windows and gnu compiler versions used are much older than under Linux). I will try a few less time-consuming things before embarking in this.
|
@slowkow Now I installed R 4.1.0.pre (today'd R devel build) and I see no crash in my laptop, and if I switch back to R 4.0.3 I get again the crash.
|
@slowkow I thought I had caught the bug, but not. All I can say that it is extremely weird and specific to Windows. There seems to be something to do with Windows or R, or package installation. I can "cure" the crashes for a while by downgrading from 'tibble' 3.0.4 to 'tibble' 3.0.3, but then they soon repear, and if I restart Windows and upgrade from 'tibble' 3.0.3 to 'tibble' 3.0.4' things work normally for a while in the same R session. At least once, doing the trick with 'tibble' did not help, but downgrading in addition from 'vcrts' 0.3.6 to 'vctrs' 0.3.5 solved the crashes for a while. This is rather perplexing! I haven't tried doing this trick with other packages than these two, I will try in the evening. I see this same thing both under R 4.0.3 and R devel. 'tibble' and 'vctrs' seemed good candidates as they had different versions in the tests above. I tried another thing: re-installing 'tibble' 3.0.4 also cures the crashes for the current R session. [Some time later:] This trick has now stopped working... I am again getting crashes consistently... I cannot really make any sense of what is going on... |
Oh boy, this sounds like a frustrating experience. Sorry for all the trouble, Pedro! I've been in this kind of debugging hell before, and it can be a nightmare. It sounds like you tried a number of different things, which is great, but also complex to think about. An important note for myself is that your example is similar but not identical to the example in the vignette. I totally overlooked the fact that you're using the entire I think I should include your crashing example in the tests, and then we can see if it runs on all platforms (CI on Github, and eventually CRAN). I hope this will eventually help to diagnose if this is indeed a problem with 'ggrepel' (I suspect that it is). With your crashing example in-hand, I should be able to reproduce your crash somewhere... I need some time to try this. Once I migrate the CRAN check from 'Travis CI' to 'Github Actions', then we will be able to test ggrepel on Windows, Linux, and macOS after every commit. TODO:
I'm sorry you have to deal with crashes, and I'll try to prioritize this. But I'm juggling a few things right now 🤹♀️, so it may be a little while. |
I am very happy to help as much as my available time allows. Having looked at both the R and C++ code in 'ggrepel' and having not too long ago written a |
My package did not have CI set up before. I just added git actions to 'gginnards' and 'ggpmisc' with package 'usethis'. I run the following statement and then committed and pushed, and the first check run on Github (visible in the actions page of the repo).
This and other examples are at https://github.com/r-lib/actions/tree/master/examples I started by reading this post https://ropensci.org/technotes/2020/11/19/moving-away-travis/ Hopefully this also works for you. |
@aphalo reports that this test crashes on some Windows platforms. So, let's include it in the tests and find out if GitHub Actions crashes or not.
@aphalo Thank you for the tip about We'll find out if GitHub Actions on Windows is crashing with your test code at this link: |
@aphalo I think the test completed on GitHub Actions Windows without crashing:
This makes me think that there must be something special about your machines, and I don't have any idea what it could be. At this point, I believe that the best way to diagnose your crash on Windows is to run ASAN on your machine. Unfortunately, I don't have a Windows machine and I can't offer any advice for setting this up. I bet that the folks at RStudio Community can help you with this. |
It seems that there is a way to run ASAN on Windows: I'm not familiar with MSVC or compiling code on Windows, so I can't offer more detailed guidance. |
@aphalo Could I please ask if you have any previous version of ggrepel that did not crash on Windows? I am wondering if we added something recently to the If we can find the offending lines, maybe we can add an if-statement to check if the platform is Windows and exclude those lines from compilation. Unfortunately, this is a bit of a ghost hunt if we can't generate any error messages. |
@aphalo In addition to testing ggrepel 0.8.2, could I ask if you might find this helpful to uncover the reason for the crash on your Windows machine?
|
Sorry! Yesterday, I missed your comment. Here is the dump. |
@aphalo Thank you! Based on your crash dump, I think we can rest assured the ggrepel is the culprit.
I searched for I'm puzzled why this is happening on Windows but not Linux or macOS. |
Could I please ask if you can try to reproduce the crash with a patched version of the code? remotes::install_github("slowkow/ggrepel@windows-crash") I hope that fixes it! 🤞 |
I am afraid it did not. |
I found this: https://www.gitmemory.com/issue/r-lib/callr/178/753449514 |
Thank you, that's a good find! I would find it very helpful if we can assign some line numbers. I tried to catch all the possible lines where there might be an "access violation," but I guess I must have missed something. |
Compiling the package with debug information did not help. I guess I need to also build R from sources with debug information. From the instructions it does not seem too difficult, but I have not done this before under Windows, so do keep fingers crossed... |
@aphalo I'm sorry for asking for so much work. I really appreciate your help. Before you embark on the (probably) lengthy journey of compiling R, I want to let you know that I might have caught another access violation. I pushed it to the I think it would be less work for you to test the new patched code before you recompile R. Could I please ask if you can try again to reproduce the crash with a patched version of the code? remotes::install_github("slowkow/ggrepel@windows-crash") DetailsAt this Stackoverflow post, Peter Alexander said:
I think I found an example of this in my code. On this line, I'm creating a vector of Line 725 in 00fa6c7
In the Line 759 in 49f5905
|
Does not seem to help. It crashes still by running the test case file on its own with 100 000 points. Without a local copy of the source I cannot run checks. If you want I can pull this branch and test, but the error in the dump file is the same. I noticed that when compiling with debug information, even if no line number is provided, I get the name of the function. So here is another dump file.
|
Just checked out the windows.crash branch and the problem seems now to be solved! I even tried 1 000 000 points and there was no crash. |
Here's how you can get the code: git clone https://github.com/slowkow/ggrepel.git
cd ggrepel
git checkout windows-crash
open src/repel_boxes.cpp
Wonderful news! Thanks so much for your patience and for your diligence in testing! 🙏 |
Note for the future: to run tests within RStudio one needs to check out the source, Installing from GitHub does not work because RStudio/devtools installs from the local sources if the installed binary does not match. This lead me stray, thinking that the new branch did not solve the problem! |
Summary
The following code example crashes R, without issuing any error message. Crashes both at the R GUI and in RStudio. This example fails consistently on my laptop. In other cases, with my spectral data, the crashes seem to depend on the state of the operating system or something else that gets reset during rebooting. I run this on a recent model laptop with 16 GB RAM and an AMD Ryzen 7 Pro 3700U processor.
'ggrepel' installed locally from source.
Minimal code example
Here is the minimum amount of code needed to demonstrate the issue:
Here is an image of the output produced by the code:
No output produced.
Suggestions
I do not have a proposal at this time.
Version information
Here is the output from
sessionInfo()
in my R session:The text was updated successfully, but these errors were encountered: