RejectedSoftware Forums

Sign up

Intermittent errors on ARM with gdc

Hi, I'm trying some of the sample apps and get very frequent intermittent errors like these :-

andrew@islay:~/vibe.d/examples/httpstaticserver$ dub --compiler=gdc
Checking dependencies in '/data/home/andrew/vibe.d/examples/httpstaticserver'
Building configuration "application", build type debug
Running gdc...
Running /tmp/dub/3305221361/http-static-server-example...
Listening for HTTP requests on 192.168.1.124:8080
Listening for HTTP requests on 127.0.0.1:8080
Got exception when resuming task onSocketRead: Resuming terminated task.
Handling of connection failed: Remote hung up while operating on TCPConnection.
Exception onTimeout: Resuming terminated task.
Got exception when resuming task onSocketRead: Resuming terminated task.
Got exception when resuming task onSocketRead: Resuming terminated task.
Exception onTimeout: Resuming terminated task.
Exception onTimeout: Resuming terminated task.
Got exception when resuming task onSocketRead: Resuming terminated task.
Got exception when resuming task onSocketRead: Resuming terminated task.
Exception onTimeout: Resuming terminated task.
Error: Program exited with code -11

Any ideas ?

Thanks

Andrew

Re: Intermittent errors on ARM with gdc

I tried debugging :-

andrew@islay:~/vibe.d/examples/httpstaticserver$ gdb ./http-static-server-example
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 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 "arm-linux-gnueabihf".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /data/home/andrew/vibe.d/examples/httpstaticserver/http-static-server-example...done.
(gdb) run
Starting program: /data/home/andrew/vibe.d/examples/httpstaticserver/http-static-server-example
[Thread debugging using libthreaddb enabled]
Using host libthread
db library "/lib/arm-linux-gnueabihf/libthreaddb.so.1".
Listening for HTTP requests on 192.168.1.124:8080
Listening for HTTP requests on 127.0.0.1:8080
Got exception when resuming task onSocketRead: Resuming terminated task.
Got exception when resuming task onSocketRead: Resuming terminated task.
Got exception when resuming task onSocketRead: Resuming terminated task.
Got exception when resuming task onSocketRead: Resuming terminated task.
Exception onTimeout: Resuming terminated task.
Exception onTimeout: Resuming terminated task.
Exception onTimeout: Resuming terminated task.
Exception onTimeout: Resuming terminated task.
^C
Program received signal SIGINT, Interrupt.
0xb6d21d2c in epoll
wait () from /lib/arm-linux-gnueabihf/libc.so.6
(gdb) bt
#0 0xb6d21d2c in epoll_wait () from /lib/arm-linux-gnueabihf/libc.so.6
#1 0xb6facc10 in ?? () from /usr/lib/arm-linux-gnueabihf/libevent-2.0.so.5
#2 0xb6facc10 in ?? () from /usr/lib/arm-linux-gnueabihf/libevent-2.0.so.5
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Re: Intermittent errors on ARM with gdc

and more :-

(gdb) cont
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x001ad15c in gcaddRange () at ../../../../gcc-4.8-20131010/libphobos/libdruntime/gc/gc.d:293
#2 0x00174fb4 in vibe.utils.memory.
T19FreeListObjectAllocTS4vibe4core7drivers13libevent2tcp10TCPContextVb0Vb1Z._T5allocTC4vibe4core6driver10DriverCoreTPS6deimos6event212eventstruct10eventbaseTiTPS6deimos6event211bufferevent11buffereventTS4vibe4core3net14NetworkAddressTS4vibe4core3net14NetworkAddressZ.alloc() ()
#3 0x00034008 in vibe.core.drivers.libevent2
tcp.onConnect() ()
#4 0x00043430 in vibe.core.core.CoreTask.run() ()
#5 0x001a37fc in fiber_entryPoint () at ../../../../gcc-4.8-20131010/libphobos/libdruntime/core/thread.d:3800
#6 0xb6cbe0b0 in setcontext () from /lib/arm-linux-gnueabihf/libc.so.6
#7 0xb6cbe0b0 in setcontext () from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

This looks pretty horrible - a problem with GDC maybe ?

Re: Intermittent errors on ARM with gdc

Looks like GDC code gen thing for me. It is hard to say, you are kind of front-liner here - ARM experiments with D are rather new thing in community on its own and "ARM + vibe.d" combo may have never been run before at all (though I won't be surprised if Sonke has some ace in the sleeves for that)

Re: Intermittent errors on ARM with gdc

Am 18.10.2013 15:03, schrieb Dicebot:

(though I won't be surprised if Sonke has some ace in the sleeves for that)

Unfortunately not directly. I've wanted to revive GDC on my Raspberry PI
for some time now, but didn't have a chance, yet. But the good news is
that my wife has just won a Kindle Fire on which I plan to install
Ubuntu Touch in a few days. That should make a much better platform for
development (1 GB RAM vs 256MB for one). Should I get everything to run,
I'll set the PI up as a CI slave.

Re: Intermittent errors on ARM with gdc

On 10/17/2013 11:41 PM, Andrew W wrote:

and more :-

(gdb) cont
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x001ad15c in gcaddRange () at ../../../../gcc-4.8-20131010/libphobos/libdruntime/gc/gc.d:293
#2 0x00174fb4 in vibe.utils.memory.
T19FreeListObjectAllocTS4vibe4core7drivers13libevent2tcp10TCPContextVb0Vb1Z._T5allocTC4vibe4core6driver10DriverCoreTPS6deimos6event212eventstruct10eventbaseTiTPS6deimos6event211bufferevent11buffereventTS4vibe4core3net14NetworkAddressTS4vibe4core3net14NetworkAddressZ.alloc() ()
#3 0x00034008 in vibe.core.drivers.libevent2
tcp.onConnect() ()
#4 0x00043430 in vibe.core.core.CoreTask.run() ()
#5 0x001a37fc in fiber_entryPoint () at ../../../../gcc-4.8-20131010/libphobos/libdruntime/core/thread.d:3800
#6 0xb6cbe0b0 in setcontext () from /lib/arm-linux-gnueabihf/libc.so.6
#7 0xb6cbe0b0 in setcontext () from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

This looks pretty horrible - a problem with GDC maybe ?

This looks like the Fiber context switching is broken.
I had to write a fiber_switchContext to get vibe running on MIPS.
Looks somewhat cryptic but is actually fairly easy.
Simply store all callee (not caller) save-registers on the stack, swap
the stack pointer and pop the saved registers from the new context.

If no asm is available getcontext/setcontext is used as fallback. But
these functions are deprecated, very inefficient and easily break
because the size of ucontextt depends on kernel internal structures.
AFAIK they aren't available on all libc implementations either.
Maybe the ucontext
t declarations in core.sys.posix.ucontext are wrong
for ARM, check ucontextt.sizeof vs. sizeof(ucontextt) in a C program.

fiberswitchContext:
https://github.com/D-Programming-Language/druntime/blob/master/src/core/threadasm.S#L277
ucontext
t:
https://github.com/D-Programming-Language/druntime/blob/master/src/core/sys/posix/ucontext.d#L454