-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Segmentation fault in CGAL::Handle::~Handle #5278
Comments
Is the code used in a multithreaded context? |
No, this sample code is not multithreaded |
At the question from @sloriot
You answer:
And yet, in your first message at #5278 (comment) we can see that the debugger detects three threads:
Do you reproduce the same issue with the single source code quoted in your first message, and without linking anything from Rtools40 (but GMP/MPFR)? |
Yes I see these 3 threads, but this is the gdb result of the provided code.
|
That is strange. If the issue is easy to reproduce, do you mind typing the following in gdb, and copy-paste the result? That way we will see the backtrace of all threads:
That is the gdb command to get the backtrace for all the threads. The issue you describe, with such a simple .cpp code, is strange. There must be something else that corrupts the heap. I also suggest to compile with the compiler flag |
Actually, I can give you advice to try and find the reason for that segfault, but be prepare for the simple answer "CGAL is not supported under such an environment", because we have never tested it, and we do not plan to support it. |
result of gdb with (gdb) run Thread 1 received signal SIGSEGV, Segmentation fault. Thread 4 (Thread 18492.0x1bc8): Thread 3 (Thread 18492.0x41b0): Thread 2 (Thread 18492.0x43ac): Thread 1 (Thread 18492.0x4454): yes rtools is based on mingw64, I try compiler flag -fsanitize=address but ASAN library is not available for Windows |
I believe this issue was fixed in CGAL 5.4 with the introduction of thread safe reference counting of Handles. Feel free to reopen it if it is not the case. |
Please use the following template to help us solving your issue.
Issue Details
A Segmentation fault occurs when the program ends with the following code in the destructor of Handle class.
I am using some CGAL features (voronoi diagram, polygon operations) inside an R package, but a segmentaton fault occurs in the test phase of the R package in 32 bits arch, not in 64 bits.
The development environment is Rtools40 https://cran.r-project.org/bin/windows/Rtools/ with gcc 8.3.0
Source Code
gdb result
I run the program with debug flags through gdb and I got this result:
GNU gdb (GDB) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "i686-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./poly.exe...
(gdb) run
Starting program: D:\Lablee\maven\geofis\geofis-r\src\package\R\test\poly\poly.exe
[New Thread 3096.0x4b1c]
[New Thread 3096.0x4a40]
[New Thread 3096.0x3da8]
polygon = 4 0 0 1 0 1 1 0 1
is_valid_polygon = 1
Thread 1 received signal SIGSEGV, Segmentation fault.
0x0045a074 in CGAL::Handle::~Handle (this=0x685269aa,
__in_chrg=)
at D:/Lablee/maven/geofis/geofis-r/src/package/R/GeoFIS/inst/include/CGAL/Handle.h:56
56 if ( PTR && (--PTR->count == 0))
(gdb)
Environment
Thanks for your help to resolve this issue.
Jean-Luc
The text was updated successfully, but these errors were encountered: