Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Bad file Descriptor issue in IO::Socket::INET

by prashantktyagi (Scribe)
on Nov 19, 2012 at 10:34 UTC ( [id://1004508]=perlquestion: print w/replies, xml ) Need Help??

prashantktyagi has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am using IO::Socket::INET in one of my server application. It was working fine before then I did some changes to it and rebuild this.
Secondly this machine has been re-imaged once too.
After that I am getting issue (not always)randomly while using this service on below line.

IO::Socket::INET->new ( LocalPort => $port, Listen => 1 ); I debuged this and got this error strings.. $!--Bad file descriptor, $^E--An operation was attempted on something +that is not a socket.

However strange thing is I am getting this issue randomly.
Please suggest me.

Replies are listed 'Best First'.
Re: Bad file Descriptor issue in IO::Socket::INET
by roboticus (Chancellor) on Nov 19, 2012 at 11:05 UTC

    prashantktyagl:

    You don't show any code, so it's hard to tell.

    • Are you properly checking your return values when performing operations that can fail?
    • Are you using global variables to hold your socket handles, possibly overwriting them with other things in other parts of your code?
    • Perhaps you're trying to continue to use a socket handle that closed?

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Hi..roboticus
      Thanks for quick reply.

      I can show the code but it is too long. This script generates service build using perlsvc. It is written in perl. The code I mentioned checks the port checking if this port is active.

        "I can show the code but it is too long."

        Create a short script which purely reproduces the problem you are experiencing. How do I post a question effectively?. Earlier:

        "It was working fine before then I did some changes to it and rebuild this"

        What have you done to determine if the code change introduced this problem? Basic debugging checklist

Re: Bad file Descriptor issue in IO::Socket::INET
by zentara (Archbishop) on Nov 19, 2012 at 12:21 UTC
    Secondly this machine has been re-imaged once too. After that I am getting issue (not always)randomly while using this service on below line.

    That may be a clue that some older version of the modules, the ones that were in the restore image, might need upgrading to latest module versions, and possibly you need a Perl upgrade.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1004508]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-03-19 11:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found