Opened 3 years ago

Closed 10 months ago

#402 closed defect (fixed)

nsclient++ service locks socket

Reported by: dvayntrub@… Owned by: MickeM
Priority: 1 Milestone: 0.4.0
Component: Core Version: 0.4.0
Severity: Bugs Keywords:
Cc: pberanger@…

Description (last modified by mickem)

The service seems to occasionally not release the socket on service shut down or service restart preventing binding to the socket on next service start. This is confirmed with both, 64 and 32 bit versions, and this was not the case prior to version 0.3.8

2010-08-06 10:48:00: message:modules\FileLogger\FileLogger.cpp:92: Starting to log for: NSClient++ - 0.3.8.75 2010-05-27
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:551: Attempting to start NSCLient++ - 0.3.8.75 2010-05-27
2010-08-06 10:48:00: message:CACHENSClient++.cpp:569: Enabling shared session...
2010-08-06 10:48:00: message:CACHENSClient++.cpp:571: Starting shared session...
2010-08-06 10:48:00: error:CACHENSClient++.cpp:577: Session already exists cant create a new one!
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:703: Found 6 sessions
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:705: Found session: 0 state: 4
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:705: Found session: 1 state: 1
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:705: Found session: 2 state: 4
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:705: Found session: 3 state: 4
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:705: Found session: 10 state: 0
2010-08-06 10:48:00: message:CACHEC:\source\nscp\branches\stable\include\nsclient_session.hpp:386: Creating session for: __10__
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:705: Found session: 65536 state: 6
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:969: Loading plugin: CheckDisk...
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:969: Loading plugin: Event log Checker....
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:969: Loading plugin: Helper function...
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:969: Loading plugin: CheckSystem...
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:969: Loading plugin: CheckTaskSched...
2010-08-06 10:48:00: debug:CACHEmodules\CheckSystem\PDHCollector.cpp:73: Autodetected w2k or later, using w2k PDH counters.
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:969: Loading plugin: File logger...
2010-08-06 10:48:00: debug:CACHEmodules\CheckSystem\PDHCollector.cpp:110: Using index to retrive counternames
2010-08-06 10:48:00: message:CACHEmodules\FileLogger\FileLogger.cpp:93: Log path is: C:\nagios\\nsclient.log
2010-08-06 10:48:00: debug:CACHENSClient++.cpp:969: Loading plugin: NRPE server (w/ SSL)...
2010-08-06 10:48:00: debug:CACHEmodules\NRPEListener\NRPEListener.cpp:91: Loading all commands (from NRPE)
2010-08-06 10:48:00: debug:CACHEmodules\NRPEListener\NRPEListener.cpp:121: Starting NRPE socket...
2010-08-06 10:48:00: debug:CACHEmodules\CheckSystem\PDHCollector.cpp:130: Found countername: CPU:    \Processor(_total)\% Processor Time
2010-08-06 10:48:00: debug:CACHEmodules\CheckSystem\PDHCollector.cpp:131: Found countername: UPTIME: \System\System Up Time
2010-08-06 10:48:00: debug:CACHEmodules\CheckSystem\PDHCollector.cpp:132: Found countername: MCL:    \Memory\Commit Limit
2010-08-06 10:48:00: debug:CACHEmodules\CheckSystem\PDHCollector.cpp:133: Found countername: MCB:    \Memory\Committed Bytes
2010-08-06 10:48:00: debug:NSClient++.cpp:671: NSCLient++ - 0.3.8.75 2010-05-27 Started!
2010-08-06 10:48:00: error:C:\source\nscp\branches\stable\include\Socket.h:677: bind failed: 10048: Only one usage of each socket address (protocol/network address/port) is normally permitted.  
2010-08-06 10:48:00: error:C:\source\nscp\branches\stable\include\Socket.h:708: Socket did not start properly, we will now do nothing...

Change History (7)

comment:1 Changed 3 years ago by mickem

  • Description modified (diff)

comment:2 Changed 3 years ago by mickem

  • Milestone changed from 0.3.8 to 0.4.0

This will be fixed in 0.4.x.

Michael Medin

comment:3 Changed 2 years ago by jeff.chung@…

Is there a work around for this besides rebooting the server or change the port? We have experience the same thing on our Windows 2008 R2 servers and some servers are really critical so we prefer to not reboot it.

-JC

comment:4 Changed 2 years ago by mickem

  • Resolution set to fixed
  • Status changed from new to closed

This is fixed in 0.4.x AFAIK (if not let me know)

comment:5 Changed 10 months ago by kronchkronch

  • Cc pberanger@… added
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 0.3.8 to 0.4.0

same thing - test with 0.4.0.72 on W2K8 R2
some time the socket steel listening with no existing process.
on nscp restart, another listening socket is create on same port with no trace in log file.
only restart or changing listening port resolve the problem

regards
PB

comment:6 Changed 10 months ago by mickem

what does netstat say for the port?

0.4.x sets the reuse flag so in theory this should work.
Latest build of 0.4.1 has a check if the flag fails to set and prints an error...

comment:7 Changed 10 months ago by kronchkronch

  • Resolution set to fixed
  • Status changed from reopened to closed

It seem to be OK.
Just an error between the starting service and the test process.
I have launched both of them at the same time ... not a good idea ;-)

regards,
PB

Note: See TracTickets for help on using tickets.