botherder/viper — pull request #130 by ianshefferman (2014-09-09 19:30:43+00:00)
Title: Wrap JSContext() with JSLocker() lock

Make JSContext thread safe by wrapping it in a lock. Multithreaded programs cause peepdf analyses to randomly segfault without this.

Examples of other people having similar issues with PyV8 in multithreaded applications:

http://inarticulateloquence.com/django-pyv8/
http://www.pythoneye.com/440_11816513/

Adding this line fixed all segfault issues with our Viper instance went away.

Ideally this patch should go into peepdf's Google Code repository as well, but I much prefer dealing with Git/GitHub. I'd appreciate it if someone could help this get into peepdf upstream.