summaryrefslogtreecommitdiff
path: root/TAO/tests/Bug_3068_Regression/README
blob: 4b708190dd752a5ebdd6921d372e83955a5d39d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
This test is for validating the fix for a race condition exposed in the
Transport_Cache_Manager. The problem is that an internal pointer used
to test intermediate return values to the cache may be deleted by one
thread before another thread tries to use it.

This situation is replicated by having a bidirectional connection set up
between a client and a server, the client provides a callback reference
that the server uses via the bidir connection. The server uses multiple
threads to force a thread into the wait state, and the client terminates
abruptly, setting the condition for the race.

$ server -ORBSvcConf server.conf -o <file.ior>
$ client -ORBSvcConf client.conf -k file://<file.ior> -x

Or, simply

$ ./run_test.pl

Even with this optimized test case, the condition is hard to trigger.
To reliably trigger the error before fixing TAO, apply this patch to
$TAO_ROOT/tao/Transport_Cache_Manager.cpp

Index: Transport_Cache_Manager.cpp
===================================================================
RCS file: /cvs/ocitao/ACE_wrappers/TAO/tao/Transport_Cache_Manager.cpp,v
retrieving revision 1.1.1.3.2.5.14.1
diff -u -b -r1.1.1.3.2.5.14.1 Transport_Cache_Manager.cpp
--- Transport_Cache_Manager.cpp 8 Mar 2007 22:33:14 -0000       1.1.1.3.2.5.14.1
+++ Transport_Cache_Manager.cpp 1 Aug 2007 19:18:21 -0000
@@ -244,6 +244,9 @@

               entry->int_id_.recycle_state (ACE_RECYCLABLE_BUSY);

+              ACE_Time_Value tv (0,500);
+              ACE_OS::sleep (tv);
+
               // NOTE: This assignment operator indirectly incurs two
               //       lock operations since it duplicates and releases
               //       TAO_Transport objects.


Once TAO is fixed, the following patch adds the same delay to the
refactored Transport Cache Manager:


--- .#Transport_Cache_Manager.cpp.1.1.1.3.2.5.14.1      2007-08-01 09:26:52.000000000 -0500
+++ Transport_Cache_Manager.cpp 2007-08-01 14:40:47.000000000 -0500
@@ -227,6 +227,9 @@
               found = CACHE_FOUND_AVAILABLE;
               entry->int_id_.recycle_state (TAO::ENTRY_BUSY);

+              ACE_Time_Value tv (0,500);
+              ACE_OS::sleep (tv);
+
               // NOTE: This assignment operator indirectly incurs two
               //       lock operations since it duplicates and releases
               //       TAO_Transport objects.