Open xiaxinmeng opened 3 years ago
The following code crashes the interpreter on Linux. I think the crash may be related to truncate().
import mmap with open('test', 'wb') as f: f.write(bytes(1)) with open('test', 'r+b') as f: m = mmap.mmap(f.fileno(), 0) f.truncate() m = m[:]
Environmental:
IronPython 3.4.0a1 (3.4.0.0001) [.NETFramework,Version=v4.6 on Mono 6.12.0.122 (tarball Mon Feb 22 17:28:32 UTC 2021) (64-bit)] on linux
Crash report:
(base) xxm@xxm-System-Product-Name:~$ ipy test.py ================================================================= Native Crash Reporting ================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. ================================================================= ================================================================= Native stacktrace: ================================================================= 0x4b8999 - /usr/bin/mono : 0x4b8d09 - /usr/bin/mono : 0x4626df - /usr/bin/mono : 0x4b17e6 - /usr/bin/mono : 0x7f48cfa9f554 - /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so : ================================================================= Telemetry Dumper: ================================================================= Pkilling 0x139950661375744x from 0x139950769272704x Could not exec mono-hang-watchdog, expected on path '/etc/../bin/mono-hang-watchdog' (errno 2) Pkilling 0x139950657173248x from 0x139950769272704x Pkilling 0x139950652970752x from 0x139950769272704x Pkilling 0x139950648768256x from 0x139950769272704x Pkilling 0x139950642431744x from 0x139950769272704x Pkilling 0x139950644549376x from 0x139950769272704x Pkilling 0x139949889791744x from 0x139950769272704x Pkilling 0x139950740342528x from 0x139950769272704x Pkilling 0x139950663476992x from 0x139950769272704x Pkilling 0x139950659274496x from 0x139950769272704x Pkilling 0x139950655072000x from 0x139950769272704x Pkilling 0x139950650869504x from 0x139950769272704x Pkilling 0x139950646667008x from 0x139950769272704x Pkilling 0x139949882898176x from 0x139950769272704x Pkilling 0x139949891892992x from 0x139950769272704x Pkilling 0x139949887690496x from 0x139950769272704x Entering thread summarizer pause from 0x139950769272704x Finished thread summarizer pause from 0x139950769272704x. Failed to create breadcrumb file (null)/crash_hash_0x8bd5e7853 Waiting for dumping threads to resume ================================================================= External Debugger Dump: ================================================================= [New LWP 21942] [New LWP 21943] [New LWP 21955] [New LWP 21956] [New LWP 21957] [New LWP 21958] [New LWP 21959] [New LWP 21960] [New LWP 21961] [New LWP 21963] [New LWP 21971] [New LWP 21972] [New LWP 21973] [New LWP 22048] [New LWP 22049] [New LWP 22050] [New LWP 22097] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 0x00007f48d340af7b in __waitpid (pid=22153, stat_loc=0x7ffe06a21674, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29 .......... Thread 1 (Thread 0x7f48d3e37780 (LWP 21941)): #0 0x00007f48d340af7b in __waitpid (pid=22153, stat_loc=0x7ffe06a21674, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29 #1 0x00000000004b8bb5 in ?? () #2 0x00000000004b8d09 in ?? () #3 0x00000000004626df in ?? () #4 0x00000000004b17e6 in ?? () #5 0x00007f48cfa9f554 in System_IO_UnmanagedMemoryAccessor_ReadByte_long (this=..., position=0) from /usr/lib/mono/aot-cache/amd64/mscorlib.dll.so #6 0x0000000041262edb in ?? () #7 0x0000000000000000 in ?? () ================================================================= Basic Fault Address Reporting ================================================================= Memory around native instruction pointer (0x7f48cfa9f554):0x7f48cfa9f544 45 f0 48 8b 4d d0 48 8b 49 18 48 03 c1 49 03 c7 E.H.M.H.I.H..I.. 0x7f48cfa9f554 0f b6 00 4c 0f b6 f8 48 c7 45 e8 00 00 00 00 48 ...L...H.E.....H 0x7f48cfa9f564 83 ec 08 e8 17 00 00 00 48 83 c4 08 48 8b 45 e8 ........H...H.E. 0x7f48cfa9f574 48 85 c0 74 05 e8 e0 f5 13 00 e9 3d 00 00 00 48 H..t.......=...H ================================================================= Managed Stacktrace: ================================================================= at System.IO.UnmanagedMemoryAccessor:ReadByte <0x00074> at MmapDefault:get_Item <0x001da> at System.Dynamic.UpdateDelegates:UpdateAndExecute4 <0x006ec> at System.Func`6:invoke_TResult_T1_T2_T3_T4_T5 <0x000dc> at Microsoft.Scripting.Interpreter.DynamicInstruction`5:Run <0x001d1> at Microsoft.Scripting.Interpreter.Interpreter:Run <0x0013e> at Microsoft.Scripting.Interpreter.LightLambda:Run1 <0x000eb> at IronPython.Compiler.RuntimeScriptCode:InvokeTarget <0x00179> at IronPython.Compiler.RuntimeScriptCode:Run <0x0002f> at IronPython.Hosting.PythonCommandLine:RunFileWorker <0x003ea> at IronPython.Hosting.PythonCommandLine:RunFile <0x0008f> at Microsoft.Scripting.Hosting.Shell.CommandLine:Run <0x00085> at IronPython.Hosting.PythonCommandLine:Run <0x003fb> at Microsoft.Scripting.Hosting.Shell.CommandLine:Run <0x0010a> at Microsoft.Scripting.Hosting.Shell.ConsoleHost:RunCommandLine <0x00177> at Microsoft.Scripting.Hosting.Shell.ConsoleHost:ExecuteInternal <0x000bb> at PythonConsoleHost:ExecuteInternal <0x00073> at Microsoft.Scripting.Hosting.Shell.ConsoleHost:Execute <0x00140> at Microsoft.Scripting.Hosting.Shell.ConsoleHost:Run <0x0068f> at PythonConsoleHost:Main <0x00082> at <Module>:runtime_invoke_int_object <0x00085> ================================================================= Aborted (core dumped)
Thanks for the report. Interestingly it's also crashing my CPython 3.8.5 interpreter.
Thank you for your patience! Yes, this case is crashing CPython, PyPy and ironPython.
The following code crashes the interpreter on Linux. I think the crash may be related to truncate().
Environmental:
Crash report: