Opened 9 years ago

Closed 9 years ago

#8738 closed Bugs (fixed)

Signal number = 0 in signal_set handler.

Reported by: alxn1@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.53.0 Severity: Problem
Keywords: asio signal_set signo Cc:

Description

In boost/asio/detail/impl/signal_set_service.ipp, if signal occured, but currently handlers queue is empty, signal_set_service will increment undelivered_ variable, but not save signal number. After what, if new handler will added, it will be called with zero signal number immediately, and undelivered_ decremented:

if (reg->undelivered_ > 0) {

--reg->undelivered_; io_service_.post_deferred_completion(op); return;

}

but signal number doesn't set (op->signal_number_ == 0 in this place).

I think, it's bug :)

It's can be reproduced with small test utility (in attachment): compile it, start, and post to it 10-15 SIGHUP's (kill -s SIGHUP <pid> | kill -s SIGHUP <pid> | kill -s SIGHUP <pid> | kill -s SIGHUP <pid> ...). In stdout you will see:

signal 1 received signal 1 received signal 1 received signal 1 received signal 1 received signal 1 received signal 1 received signal 1 received signal 0 received signal 1 received signal 1 received signal 1 received signal 1 received signal 0 received signal 1 received

In some cases signal number is zero.

Attachments (1)

asio_bug.cpp (568 bytes ) - added by alxn1@… 9 years ago.
boost::asio::signal_set zero signal number bug.

Download all attachments as: .zip

Change History (2)

by alxn1@…, 9 years ago

Attachment: asio_bug.cpp added

boost::asio::signal_set zero signal number bug.

comment:1 by chris_kohlhoff, 9 years ago

Resolution: fixed
Status: newclosed

Fixed on trunk in [85746]. Merged to release in [85838]

Note: See TracTickets for help on using tickets.