HomerReid / scuff-em

A comprehensive and full-featured computational physics suite for boundary-element analysis of electromagnetic scattering, fluctuation-induced phenomena (Casimir forces and radiative heat transfer), nanophotonics, RF device engineering, electrostatics, and more. Includes a core library with C++ and python APIs as well as many command-line applications.
http://www.homerreid.com/scuff-em
GNU General Public License v2.0
125 stars 50 forks source link

Segmentation fault while running scuff-rf for testing #234

Open deathdance9 opened 2 years ago

deathdance9 commented 2 years ago

I installed scuff without-hdf5 and by adding the library location to the bashrc file as suggested in #204 and even though the install was sucessfull on running the test case I only get a segmentation error(core dumped) wihtout any processing.

I tried updating Linux and rebooted and even deleted any broken packages and reinstalled scuff-em. I face this problem in both WSL2 and mint linux.

texnokrates commented 2 years ago

It is hard to help without any knowledge about your input data and command line arguments. It would also be helpful to know at which point of the program the segmentation fault happens (you can open the core dump file using a debugger and get the backtrace. With gdb, you should be able to run something like gdb scuff-rf -c core.something and then simply bt full which will get you the function call backtrace and we should then be able to see at leest where it failed.

BTW, did you try using my fork? It has some of the memory issues (which can cause segfaults) fixed.

deathdance9 commented 2 years ago

When i Run bt full the system replies with no stack, I am running the test exactly how the installtion documents have instructed . RunScript.SZParms in the install folder share/scuff-em/examples/YagiUdaAntennas scuff-err

I have not used your fork i will try a new install with yours now

texnokrates commented 2 years ago

The core.something wasn't supposed to be literally core.something... You need to replace it with the actual name of your file dump. And you either need to do it on the system that segfaulted with core dump or you need to enable the core dumps on the system you are currently using.

See for example https://jvns.ca/blog/2018/04/28/debugging-a-segfault-on-linux/ on how to enable core dumps.

deathdance9 commented 2 years ago

on running the bt full command with your fork i get the following file

kunal@LAPTOP-1GR5RQJT:/tmp$ gdb scuff-rf -c core-scuff-rf.22501.LAPTOP-1GR5RQJT.1626815688 GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1 Copyright (C) 2018 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 "x86_64-linux-gnu". 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 scuff-rf...done. [New LWP 22501] [New LWP 22509] [New LWP 22505] [New LWP 22506] [New LWP 22503] [New LWP 22504] [New LWP 22510] [New LWP 22507] [New LWP 22502] [New LWP 22508] [New LWP 22512] [New LWP 22511] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `scuff-rf --portfile ./portFiles/Dipole.ports --minfreq 2.0 --maxfreq 4.0 --numf'. Program terminated with signal SIGSEGV, Segmentation fault. #0 GIIO_setbuffer (fp=0x0, buf=0x0, size=8192) at iosetbuffer.c:33 33 iosetbuffer.c: No such file or directory. [Current thread is 1 (Thread 0x7f6bef82d300 (LWP 22501))] (gdb) bt full #0 GIIO_setbuffer (fp=0x0, buf=0x0, size=8192) at iosetbuffer.c:33 _IO_acquire_lock_file = 0x0 #1 0x000055f9c49d52b2 in main (argc=13, argv=0x7ffe7ef00168) at scuff-rf.cc:279 GeoFile = 0x55f9c60d3310 "./scuffgeoFiles/YUAntenna_N2_Medium.scuffgeo" PortFile = 0x55f9c60d32e0 "./portFiles/Dipole.ports" PCFile = 0x0 EPFiles = {0x7f6bef82e580 "/usr/lib/x86_64-linux-gnu/libquadmath.so.0", 0x2f <error: Cannot access memory at address 0x2f>, 0x7f6bea4ae406 "libquadmath.so.0", 0xef621377 <error: Cannot access memory at address 0xef621377>, 0x6d6461757162696c <error: Cannot access memory at address 0x6d6461757162696c>, 0x0, 0x7ffe7eeff410 ">\330\235\304\371U", 0x7f6bef6271ce <_dl_add_to_namespace_list+30> "H\215\004\333H\301\340\004H\001\350H\213\020H\205\322u\n\353U\017\037D", 0x7f6bef82e5b0 "", 0x7ffe7eeff410 ">\330\235\304\371U"} nEPFiles = 0 FVMeshes = {0x37ffff1a0 <error: Cannot access memory at address 0x37ffff1a0>, 0x7f6bef622447 <_dl_map_object_from_fd+3047> "\213\005\303$\"", 0x7ffe7eeff440 "\202\330\235\304\371U", 0x3ef6271ce <error: Cannot access memory at address 0x3ef6271ce>, 0x7ffe7eeff170 "w\211\311\302Tr\225?", 0x23f490 <error: Cannot access memory at address 0x23f490>, 0x7f6bea077490 "619dda883107f64915a317.debug", 0x7ffe00000003 <error: Cannot access memory at address 0x7ffe00000003>, 0x7ffe7eeff2d0 "@\364\357~\376\177", 0x0} nFVMeshes = 0 PlotPorts = 0 ZParameters = 1 SParameters = 1 Moments = 0 FrequencyValues = {6.9530366276121344e-310, 2.9643938750474793e-323, 6.9219320583670419e-310, 1.8918267644907171e-319, 6.9219366073843821e-310, 6.9219366025812736e-310, 6.3659873728958169e-314, 6.9219322767166861e-310, 1.0197514930163329e-320, 1.8918267644907171e-319} nFrequency = 0 MinFreq = 2 nMinFreq = 1 MaxFreq = 4 nMaxFreq = 1 NumFreqs = 100 nNumFreqs = 1 LogFreq = 0 FreqFile = 0x0 Cache = 0x0 ReadCache = {0x1 <error: Cannot access memory at address 0x1>, 0x81a4 <error: Cannot access memory at address 0x81a4>, 0x0, 0x0, 0x3fc70 <error: Cannot access memory at address 0x3fc70>, 0x1000 <error: Cannot access memory at address 0x1000>, 0x200 <error: Cannot access memory at address 0x200>, 0x60f736b7 <error: Cannot access memory at address 0x60f736b7>, 0x8583b00 <error: Cannot access memory at address 0x8583b00>, 0x5e678842 <error: Cannot access memory at address 0x5e678842>} nReadCache = 0 WriteCache = 0x0 FileBase = 0x55f9c60d3350 "YUAntenna_N2_Medium" OSArray = {{Name = 0x55f9c49dd814 "geometry", Type = 2, NumArgs = 1, MaxInstances = 1, Storage = 0x7ffe7eeff1f0, NumInstances = 0x0, Description = 0x55f9c49dd81d "geometry file"}, { Name = 0x55f9c49dd82b "portfile", Type = 2, NumArgs = 1, MaxInstances = 1, Storage = 0x7ffe7eeff1f8, NumInstances = 0x0, Description = 0x55f9c49dd834 "port file"}, {Name = 0x55f9c49dd83e "PlotPorts", Type = 3, NumArgs = 0, MaxInstances = 1, Storage = 0x7ffe7eeff1c0, NumInstances = 0x0, Description = 0x55f9c49ddc88 "generate port visualization file"}, {Name = 0x55f9c49dd882 "frequency", Type = 0, NumArgs = 1, MaxInstances = 10, Storage = 0x7ffe7eeff310, NumInstances = 0x7ffe7eeff1d0, Description = 0x55f9c49dd848 "frequency (GHz)"}, {Name = 0x55f9c49dd858 "minfreq", Type = 0, NumArgs = 1, MaxInstances = 1, Storage = 0x7ffe7eeff208, NumInstances = 0x7ffe7eeff1d4, Description = 0x55f9c49dd860 "starting frequency"}, {Name = 0x55f9c49dd873 "maxfreq", Type = 0, NumArgs = 1, MaxInstances = 1, Storage = 0x7ffe7eeff210, NumInstances = 0x7ffe7eeff1d8, Description = 0x55f9c49dd87b "ending frequency"}, {Name = 0x55f9c49dd88c "numfreqs", Type = 1, ---Type to continue, or q to quit---
Capture

texnokrates commented 2 years ago

@deathdance9, I strongly recommend looking at markdown syntax for writing your posts here. In particular, place triple backticks ``` (on separate lines) around the console output, like this:

console output here

otherwise github will not show the linebreaks and it is pretty hard to read the output. Also please provide the whole output. (You see the line ---Type <return> to continue, or q <return> to quit---, right? That means the output continues, but you must press return / enter to see it and then copy&paste the rest as well.)

I tried running the same example on my laptop and it runs fine without crashing. From the incomplete backtrace you provided I'd guess that in your case the program crashes on calling setbuf() on a NULL stream pointer, meaning that at line scuff-rf.cc:305, CreateUniqueFile() from libs/libhrutil/libhrutil.cc:807 probably returned a NULL pointer (I don't know why exactly) and there is no proper return/error value checking (nor exceptions) in the relevant parts of the code.