Opened 9 years ago

Closed 9 years ago

#367 closed defect (fixed)

SIGPIPE in boss process

Reported by: shane Owned by: shane
Priority: low Milestone:
Component: ~Boss of BIND (obsolete) Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity:
Sub-Project: Feature Depending on Ticket:
Estimated Difficulty: 0.5 Add Hours to Ticket: 0
Total Hours: 0.5 Internal?: no

Description

I hit "Ctrl-C" to stop BIND 10, and I got the following:

[bind10] Received SIGINT.
[bind10] Boss got command:
Traceback (most recent call last):

File "/opt/bind10/sbin/bind10", line 755, in <module>

main()

File "/opt/bind10/sbin/bind10", line 741, in main

boss_of_bind.ccs.check_command()

File "/opt/bind10/lib/python3.1/site-packages/isc/config/ccsession.py", line 229, in check_command

self._session.group_reply(env, answer)

File "/opt/bind10/lib/python3.1/site-packages/isc/cc/session.py", line 265, in group_reply

}, isc.cc.message.to_wire(msg))

File "/opt/bind10/lib/python3.1/site-packages/isc/cc/session.py", line 87, in sendmsg

self._socket.send(struct.pack("!I", length))

socket.error: [Errno 32] Broken pipe

What is going on is that we have a race condition:

  1. A message for the boss has arrived.
  2. Ctrl-C hit.
  3. msgq dies.
  4. The boss tries to receive the message from the msgq (which also writes to the socket for some reason).

When the write happens SIGPIPE arrives.

There are several possibilities to fix this. It could be in the cc module, or in the boss itself. For example, the cc module could disable SIGPIPE before each write, and restore it to the original state. (This is quite inefficient, and not necessary in most cases.)

The easiest solution is to disable SIGPIPE in the boss process, which is what this ticket implements.

Unfortunately writing a test for this would be tricky, so I have not done so, since it is literally a one-line patch and would require quite a bit of work setting up a test as no framework exists now. :(

Subtickets

Change History (2)

comment:1 Changed 9 years ago by shane

This should fix it.

--- bind10.py.in.org	2010-10-12 15:03:43.000000000 +0200
+++ bind10.py.in	2010-10-12 15:26:09.000000000 +0200
@@ -710,6 +710,9 @@
     signal.signal(signal.SIGINT, fatal_signal)
     signal.signal(signal.SIGTERM, fatal_signal)
 
+    # Block SIGPIPE, as we don't want it to end this process
+    signal.signal(signal.SIGPIPE, signal.SIG_IGN)
+
     # Go bob!
     boss_of_bind = BoB(options.msgq_socket_file, int(options.auth_port),
                        options.address, options.nocache, options.verbose,

comment:2 Changed 9 years ago by shane

  • Add Hours to Ticket changed from 0.0 to 0.5
  • Resolution set to fixed
  • Status changed from new to closed
  • Total Hours changed from 0.0 to 0.5

Michal reviewed the patch in Jabber. Committed with svn r3190.

Note: See TracTickets for help on using tickets.