Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Troubleshooting OSError: out of pty devices

Tags:

python

linux

pty

From time to time I'm getting an OSError exception with the message 'out of pty devices' when calling pty.openpty() (it's happening when a bunch of instances of my scripts run concurrently).

What is the limit that I'm hitting? How can I get around this?

CentOS 5.6, Python 2.4

like image 768
kdt Avatar asked Dec 19 '11 12:12

kdt


2 Answers

In my Ubuntu Linux, the max number of open ptys is given by:

cat /proc/sys/kernel/pty/max

This value is configurable in:

/etc/sysctl.conf

All this info, and much more can be found in:

man pty
like image 118
mirk Avatar answered Oct 17 '22 06:10

mirk


Same issue is raised when devpts is not mounted, usually in chroots, to mount devpts device type:

mount -t devpts none /path/to/chroot/dev/pts
like image 30
reddot Avatar answered Oct 17 '22 08:10

reddot