ReadFile segfaulting

The engine.
Post Reply
nikkne
Posts: 19
Joined: Tue Mar 18, 2008 8:03 pm

ReadFile segfaulting

Post by nikkne »

Hi,
when I try to call

Code: Select all

theNet.ReadFile("/home/nikkne/test.xdsl");
it segfaults. File exists, it was created by WriteFile() call, and is brutally simple.

coredump's backtrace shows this:

Code: Select all

Program terminated with signal 11, Segmentation fault.
#0  0x080f39c9 in DSL_header::SetId ()
(gdb) bt
#0  0x080f39c9 in DSL_header::SetId ()
#1  0x0809c5fb in (anonymous namespace)::XmlNetLoader::StartSmile ()
#2  0x080a6b87 in XmlReader::EnterElement ()
#3  0x080a716d in XmlReader::OnStartElement ()
#4  0x0814fa54 in doContent ()
#5  0x08151beb in doProlog ()
#6  0x08154a14 in prologInitProcessor ()
#7  0x0814a709 in XML_Parse ()
#8  0x080a741a in XmlReader::Parse ()
#9  0x080a274e in (anonymous namespace)::XmlNetLoader::LoadNetwork ()
#10 0x080a27f8 in XmlLoad ()
#11 0x08095fb8 in DSL_xdslSpeaker::ReadNetwork ()
#12 0x0807543f in DSL_network::ReadFile ()
#13 0x08056210 in SkuldSystem::open_network (this=0xb70bf230, network=0x81b25e4 "test.xdsl") at ssystem.cxx:155
Any thoughts?
It happens with any file I try :(
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: ReadFile segfaulting

Post by shooltz[BayesFusion] »

nikkne wrote:Any thoughts?
Nothing I can think of. Basic I/O tests are part of the release sequence; for each SMILE build we compile/run the verification app which among other things calls Read/WriteFile. This means that on our machine it worked.

Can you write simple app which doesn't link to any other external library except SMILE and just calls ReadFile, then exits? If you get the segfault in that case, post the 'brutally simple file' here - maybe it's brutal, but not that simple :)
nikkne
Posts: 19
Joined: Tue Mar 18, 2008 8:03 pm

Re: ReadFile segfaulting

Post by nikkne »

shooltz wrote:Can you write simple app which doesn't link to any other external library except SMILE and just calls ReadFile, then exits? If you get the segfault in that case, post the 'brutally simple file' here - maybe it's brutal, but not that simple :)
:) I'll do that right away...
I discovered that I don't need to call ReadFile at all, to get segfault. If I call theNet.Header().SetId("test"); it segfaults.

Cheers,
Nikola
nikkne
Posts: 19
Joined: Tue Mar 18, 2008 8:03 pm

Re: ReadFile segfaulting

Post by nikkne »

nikkne wrote: :) I'll do that right away...
I discovered that I don't need to call ReadFile at all, to get segfault. If I call theNet.Header().SetId("test"); it segfaults.
Solved! :)
I had a bug with pthreads. The object which contained theNet was created inside main(), which passed pointer to it to other threads... Since main() exited, without waiting for other threads, it stack got removed, as so was the object...
Post Reply