Getting "runtime/cgo: pthread_create failed: Resource temporarily unavailable" crashes

495 views
Skip to first unread message

jona...@similarweb.com

unread,
Mar 1, 2015, 2:50:53 PM3/1/15
to golan...@googlegroups.com
Hey,
We have a daemon that keeps crashing with the following error:

runtime/cgo: pthread_create failed: Resource temporarily unavailable
SIGABRT: abort
PC=0x393f432625

[goroutines....]

We have 2 XML libraries we're using in that daemon (https://bitbucket.org/martende/goxml and https://github.com/moovweb/gokogiri), both use LibXML, which is written in C, so I guess the cgo calls are coming from here.

There is a need for both libraries in our daemon - well, we need to parse XML and execute XPaths, and parse unformed HTML documents to DOM - and these libraries allow this.

Is there any way to handle such errors without changing our XML frameworks?

Thanks.

Dave Cheney

unread,
Mar 1, 2015, 3:30:58 PM3/1/15
to golan...@googlegroups.com, jona...@similarweb.com
Calls to C via cgo are effectively a syscall, they block an entire system thread. If you cannot avoid those cgo dependencies then you will have to gate calls to those libraries with some kind of semaphore, probably using a channel as a semaphore.
Reply all
Reply to author
Forward
0 new messages