Simple python console-script "runtime: failed to create new OS thread"

Hi all,

I’ve built a new snap with a simple python console-script but when trying to run I get

runtime: failed to create new OS thread (have 5 already; errno=11)
runtime: may need to increase max user processes (ulimit -u)
fatal error: newosproc

I am running Ubuntu 17.10 with snapd 2.30 and my snapcraft https://github.com/philroche/ubuntu-watch-packages/blob/master/snap/snapcraft.yaml.

I couldn’t find any snap specific references to this error, is it a known/common issue?

The script runs fine with not run as a snap.

[edit: added full error message]

Thanks to some guidance from sparkiegeek the cause of this error was using the _thread module.

https://docs.python.org/3/library/_thread.html

Using the threading module instead works fine.