Opened 11 years ago

Closed 10 years ago

#6548 closed Bugs (invalid)

boost asio async_accept thread context

Reported by: aladjev.andrew@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.46.1 Severity: Problem
Keywords: c++ networking unix socket Cc: aladjev.andrew@…

Description

how to see the problem: 1) compile attached cpp 2) run program 2) accept /tmp/test unix socket more than 2 times

the output will be like: start from 0x1215810 start from 0x12154c0 accept from 0x12154c0, async_accept from 0x1215810 accept from 0x12154c0, async_accept from 0x12154c0 and program is still running!

the output should be like: start from 0x1215810 start from 0x12154c0 accept from 0x1215810, async_accept from 0x1215810 accept from 0x12154c0, async_accept from 0x12154c0 and program should stop!

Attachments (1)

asio_bug.cpp (1.1 KB ) - added by aladjev.andrew@… 11 years ago.

Download all attachments as: .zip

Change History (3)

by aladjev.andrew@…, 11 years ago

Attachment: asio_bug.cpp added

comment:1 by anonymous, 11 years ago

the output will be like:

start from 0x1215810
start from 0x12154c0
accept from 0x12154c0, async_accept from 0x1215810
accept from 0x12154c0, async_accept from 0x12154c0

and program is still running!

the output should be like:

start from 0x1215810
start from 0x12154c0
accept from 0x1215810, async_accept from 0x1215810
accept from 0x12154c0, async_accept from 0x12154c0

and program should stop!

comment:2 by chris_kohlhoff, 10 years ago

Resolution: invalid
Status: newclosed

Your conclusion is not correct. There is only one acceptor object, and all of its completion handlers will be delivered through its associated io_service, which in this case is io_1. Which thread you start the async_accept operation from does not matter.

The program does not stop because you have created io_service::work objects that you do not destroy. See here for more details.

Note: See TracTickets for help on using tickets.