On Wed, Nov 14, 2012 at 2:36 PM, <
j...@cloudflare.com> wrote:
> I have a long running Go program that aborted with the
>
> error: runtime/cgo: pthread_create failed: xÓ"!
> SIGABRT: abort
> PC=0x800af5cbc
As far as I can tell, that error message is coming from these lines in
runtime/cgo/gcc_freebsd_amd64.c:
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
abort();
}
But it's peculiar that these lines do not print "error: ". I don't
know where that is coming from in your output. And, of course,
strerror should not return a garbage string. This code is compiled by
gcc and invokes libc functions in the usual way. strerror should not
return a garbage pointer.
Hmmm, wait. This file does not #include <string.h>. It's possible
that strerror was never declared and that GCC is implicitly declaring
it to return int. On amd64 int is 32 bits and char* is 64 bits, so it
is possible that when the return value is moved from %rax to %rdx only
the low order 32 bits are moved. This might then be an invalid
pointer, causing printf to spit out garbage. A series of guesses, to
be sure, but a possible explanation for what you are seeing, except
for the "error: " string. But to be safe let's have all those files
#include <string.h>. Unfortunately, if these guesses are correct,
there is no way to determine what error pthread_create actually
returned.
Ian