tags:

views:

42

answers:

1

Could use some help. I am utterly stuck, been trying to fix this one for a whole week. I have a perl script that acts as an email server. After it sets up 1,020 SSL Sockets, it starts failing every time when for every socket before that works fine. Any suggestions? Why is it saying bad hostname?

The error I get is
Setting up user 1014...DONE!
Setting up user 1015...DONE!
Setting up user 1016...DONE!
Setting up user 1017...DONE!
Setting up user 1018...DONE!
Setting up user 1019...DONE!
Setting up user 1020...ERROR: new_imap: socket(): IO::Socket::SSL: Bad hostname 'imap.gmail.com'
Try 2: ERROR: new_imap: socket(): IO::Socket::SSL: Bad hostname 'imap.gmail.com'

If I turn on DEBUG in IO::Socket::SSL, it spits out a bunch of numbers along with this,
SSL.pm:1201: IO::Socket::INET configuration failederror:00000000:lib(0):func(0):reason(0)

+4  A: 

It sounds like you might be running out of file descriptors. Are you keeping all these sockets open at the same time? Or if you're closing them, maybe your SO_LINGER setting is making them stick around longer than you'd like?

Depending on your platform, you may be able to configure it to increase the number of file descriptors available to each process.

Jim Lewis
Wow, perfect. Great answer. This community rocks. I'll try increasing the upper limit of file descriptors see if that fixes it
casey
Yep, used BSD::Resource to increase the nofiles limit at script startup, can go way past 1,020 now
casey
@casey: Glad to hear it worked out!
Jim Lewis