| 1 |
|
| 2 |
|
| 3 |
ACE reactor demonstration |
| 4 |
========================= |
| 5 |
|
| 6 |
Martin Kolleck |
| 7 |
Tino Riethmuller |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
1. Introduction |
| 12 |
|
| 13 |
This program demonstrates what we think is a bug in the ACE library. The |
| 14 |
affected component is the ACE_TP_Reactor. According to the documentation, the |
| 15 |
reactor ensures that only one of the handle_*() methods of an event handler is |
| 16 |
called at a time. Tino found this to be not true and I wrote this example |
| 17 |
program showing the behavior. I do not exclude the possibility that we are |
| 18 |
using the ACE library in an unintended/wrong way. So comments on the code as |
| 19 |
well as any other remarks are welcome. |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
2. The program |
| 24 |
|
| 25 |
The program consists of a client and a server. The general implementation is |
| 26 |
taken from the example solution to exercise 4c of the ACE course. The client |
| 27 |
will send a request to the server. This request is interpreted to be the size |
| 28 |
of the following data. The server allocates the memory required to hold the |
| 29 |
client's data and then sends a confirmation to the client, that it may |
| 30 |
proceed. The the client sends the large data chunk and the server again |
| 31 |
confirms it. |
| 32 |
|
| 33 |
The client runs in a loop which can be configured to run indefinitely or a |
| 34 |
previously set amount of times. The configuration i done from the command |
| 35 |
line. To invoke the client type: |
| 36 |
|
| 37 |
$ ./client size [count] |
| 38 |
|
| 39 |
<size> sets the size (in MiB) of the buffer sent to the server. Depending on |
| 40 |
the systems, values between 60 and 100 have been used for testing. <count> |
| 41 |
determines how often the buffer is sent. If left out, the clients send the |
| 42 |
buffer until interrupted. |
| 43 |
|
| 44 |
The server is started without arguments. Both programs will print a dot for |
| 45 |
each successful connection. I found this an easy and unintrusive way of showing |
| 46 |
progress whithout flooding the console too fast. This also makes it easier to |
| 47 |
see when an error has occurred. |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
3. Building the program |
| 52 |
|
| 53 |
This example was created on a Linux box. You will need the environment |
| 54 |
variable ACE_ROOT set up to the location where ACE is installed. It might be |
| 55 |
possible, that the path where the ACE libraries are found, needs to be adjusted |
| 56 |
in the Makefile. |
| 57 |
|
| 58 |
To compile simply type 'make' on the command prompt. |
| 59 |
|
| 60 |
$ make |
| 61 |
|
| 62 |
This will create two executable files. One for the server and one for the |
| 63 |
client. (named respectively) |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
4. Running the program |
| 68 |
|
| 69 |
The error seems to be of statistical nature. Occurring only under certain |
| 70 |
conditions (which I am not sure of, what they are). I successfully produced |
| 71 |
the error on the four machines given below (architecture, ACE and compiler |
| 72 |
version). I tested the program with localhost connections, as well as over |
| 73 |
a real network connection and could always reproduce the error. |
| 74 |
|
| 75 |
To detect the error I introduced a member variable to the read event handler. |
| 76 |
This counter is initialized to zero in the constructor. When handle_input() of |
| 77 |
the event handler is called, the counter is increased and decreased, when |
| 78 |
handle_input() returns. Before increasing the counter, It is compared to zero |
| 79 |
(which it should alway be, if only one invocation to handle_input() is made |
| 80 |
at a time) and an error message is printed if it is not zero. |
| 81 |
|
| 82 |
To test for the error, I ran one instance of the server program and TWO |
| 83 |
instances of the client program. The sizes of the buffers were between 60 and |
| 84 |
100 MiB and no count was given (running until stopped) The three Linux boxes |
| 85 |
showed the error within one minute of starting both clients. For the Windows |
| 86 |
box I decreased the buffer size to 15 and 20 MiB (Windows does not seem to have |
| 87 |
very performant localhost connectivity) and it took about half an |
| 88 |
hour until the error occurred the first time. |