Skip to content

Commit db5221a

Browse files
committed
Bug 36730974 - CPP: deadlock on service start with the EventDispatcher thread
[git-p4: depot-paths = "//dev/main.cpp/": change = 109576]
1 parent af547a0 commit db5221a

File tree

16 files changed

+107
-337
lines changed

16 files changed

+107
-337
lines changed

include/private/coherence/component/net/extend/RemoteService.hpp

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
#ifndef COH_REMOTE_SERVICE_HPP
88
#define COH_REMOTE_SERVICE_HPP
@@ -89,14 +89,6 @@ class COH_EXPORT RemoteService
8989
*/
9090
virtual bool isServiceThread(bool fStrict) const;
9191

92-
/**
93-
* Block the calling thread until the ConnectionInitiator
94-
* EventDispatcher Queue is empty and all outstanding tasks have been
95-
* executed.
96-
*/
97-
virtual void drainEvents();
98-
99-
10092
// ----- Service interface ----------------------------------------------
10193

10294
public:
@@ -315,16 +307,16 @@ class COH_EXPORT RemoteService
315307
* @return an open Channel to the ProxyService
316308
*/
317309
virtual Channel::Handle openChannel() = 0;
318-
310+
319311
/**
320-
* Obtains the connect address of the ProxyService from a remote
312+
* Obtains the connect address of the ProxyService from a remote
321313
* NameService.
322314
*
323315
* @since Coherence 12.1.2
324316
*/
325317
virtual void lookupProxyServiceAddress();
326-
327-
318+
319+
328320
// ----- accessors ------------------------------------------------------
329321

330322
public:
@@ -369,7 +361,7 @@ class COH_EXPORT RemoteService
369361
* @param vsName the new Service name
370362
*/
371363
virtual void setServiceName(String::View vsName);
372-
364+
373365
/**
374366
* Return the name of the remote Cluster to which this RemoteService will connect.
375367
*
@@ -396,7 +388,7 @@ class COH_EXPORT RemoteService
396388
* @since Coherence 12.2.1
397389
*/
398390
virtual String::View getRemoteServiceName() const;
399-
391+
400392
/**
401393
* Set the remote proxy service name.
402394
*
@@ -406,7 +398,7 @@ class COH_EXPORT RemoteService
406398
*/
407399
virtual void setRemoteServiceName(String::View vsName);
408400

409-
/**
401+
/**
410402
* Return whether the remote AddressProvider address are to be used
411403
* to look up the remote address of the ProxyService.
412404
*
@@ -416,38 +408,38 @@ class COH_EXPORT RemoteService
416408
* @since Coherence 12.1.2
417409
*/
418410
virtual bool isNameServiceAddressProvider() const;
419-
411+
420412
/**
421413
* Configure whether the remote AddressProvider address are to be used
422414
* to look up the remote address of the ProxyService.
423-
*
424-
* @param fNameServiceAddressProvider true if the remote AddressProvider
425-
* address are to be use to look up
415+
*
416+
* @param fNameServiceAddressProvider true if the remote AddressProvider
417+
* address are to be use to look up
426418
* the remote address of the ProxyService
427419
*
428420
* @since Coherence 12.1.2
429421
*/
430422
virtual void setNameServiceAddressProvider(bool fNameServiceAddressProvider);
431423

432-
/**
424+
/**
433425
* Return the XML element used to configure the Initiator.
434426
*
435427
* @return the XML element used to configure the Initiator
436428
*
437429
* @since Coherence 12.1.2
438430
*/
439431
virtual XmlElement::View getXml() const;
440-
432+
441433
/**
442434
* Configure the XML element used to configure the Initiator.
443-
*
435+
*
444436
* @param vXml the XML element used to configure the Initiator
445437
*
446438
* @since Coherence 12.1.2
447439
*/
448440
void setXml(XmlElement::View vXml);
449441

450-
442+
451443
protected:
452444
/**
453445
* Configure the ConnectionInitiator used to connect to a
@@ -496,13 +488,13 @@ class COH_EXPORT RemoteService
496488
* The name of the remote ProxyService.
497489
*/
498490
MemberView<String> m_vsRemoteServiceName;
499-
491+
500492
/**
501493
* Whether the remote AddressProvider address are to be used
502494
* to look up the remote address of the ProxyService.
503495
*/
504496
bool m_fNameServiceAddressProvider;
505-
497+
506498
/**
507499
* The XML element used to configure the Initiator.
508500
*/

include/private/coherence/component/util/SafeCacheService.hpp

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
#ifndef COH_SAFE_CACHE_SERVICE_HPP
88
#define COH_SAFE_CACHE_SERVICE_HPP
@@ -96,28 +96,18 @@ class COH_EXPORT SafeCacheService
9696
* it. If the CacheService is not running and has not been explicitly
9797
* stopped, theCacheService is restarted.
9898
*
99-
* @param fDrain if true, the calling thread will be blocked until
100-
* the wrapped CacheService event dispatcher queue is
101-
* empty and all outstanding tasks have been executed
102-
*
10399
* @return the running wrapped CacheService
104100
*/
105-
virtual CacheService::Handle ensureRunningCacheService(
106-
bool fDrain);
101+
virtual CacheService::Handle ensureRunningCacheService();
107102

108103
/**
109104
* Ensures that the returned CacheService is running before returning
110105
* it. If the CacheService is not running and has not been explicitly
111106
* stopped, theCacheService is restarted.
112107
*
113-
* @param fDrain if true, the calling thread will be blocked until
114-
* the wrapped CacheService event dispatcher queue is
115-
* empty and all outstanding tasks have been executed
116-
*
117108
* @return the running wrapped CacheService
118109
*/
119-
virtual CacheService::View ensureRunningCacheService(
120-
bool fDrain) const;
110+
virtual CacheService::View ensureRunningCacheService() const;
121111

122112

123113
// ----- helper methods -------------------------------------------------
@@ -135,14 +125,9 @@ class COH_EXPORT SafeCacheService
135125
* it. If the CacheService is not running and has not been explicitly
136126
* stopped, theCacheService is restarted.
137127
*
138-
* @param fDrain if true, the calling thread will be blocked until
139-
* the wrapped CacheService event dispatcher queue is
140-
* empty and all outstanding tasks have been executed
141-
*
142128
* @return the running wrapped CacheService
143129
*/
144-
virtual CacheService::Handle ensureRunningCacheServiceInternal(
145-
bool fDrain) const;
130+
virtual CacheService::Handle ensureRunningCacheServiceInternal() const;
146131

147132

148133
// ----- property getters/setters ---------------------------------------

include/private/coherence/component/util/SafeInvocationService.hpp

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
#ifndef COH_SAFE_INVOCATION_SERVICE_HPP
88
#define COH_SAFE_INVOCATION_SERVICE_HPP
@@ -69,28 +69,18 @@ class COH_EXPORT SafeInvocationService
6969
* returning it. If the InvocationService is not running and has not
7070
* been explicitly stopped, the InvocationService is restarted.
7171
*
72-
* @param fDrain if true, the calling thread will be blocked until
73-
* the wrapped CacheService event dispatcher queue is
74-
* empty and all outstanding tasks have been executed
75-
*
7672
* @return the running wrapped InvocationService
7773
*/
78-
virtual InvocationService::Handle ensureRunningInvocationService(
79-
bool fDrain);
74+
virtual InvocationService::Handle ensureRunningInvocationService();
8075

8176
/**
8277
* Ensures that the returned InvocationService is running before
8378
* returning it. If the InvocationService is not running and has not
8479
* been explicitly stopped, the InvocationService is restarted.
8580
*
86-
* @param fDrain if true, the calling thread will be blocked until
87-
* the wrapped CacheService event dispatcher queue is
88-
* empty and all outstanding tasks have been executed
89-
*
9081
* @return the running wrapped InvocationService
9182
*/
92-
virtual InvocationService::View ensureRunningInvocationService(
93-
bool fDrain) const;
83+
virtual InvocationService::View ensureRunningInvocationService() const;
9484

9585

9686
// ----- property getters/setters ---------------------------------------
@@ -112,14 +102,10 @@ class COH_EXPORT SafeInvocationService
112102
* returning it. If the InvocationService is not running and has not
113103
* been explicitly stopped, the InvocationService is restarted.
114104
*
115-
* @param fDrain if true, the calling thread will be blocked until
116-
* the wrapped CacheService event dispatcher queue is
117-
* empty and all outstanding tasks have been executed
118-
*
119105
* @return the running wrapped InvocationService
120106
*/
121107
virtual InvocationService::Handle
122-
ensureRunningInvocationServiceInternal(bool fDrain) const;
108+
ensureRunningInvocationServiceInternal() const;
123109
};
124110

125111
COH_CLOSE_NAMESPACE3

include/private/coherence/component/util/SafeService.hpp

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
#ifndef COH_SAFE_SERVICE_HPP
88
#define COH_SAFE_SERVICE_HPP
@@ -197,35 +197,18 @@ class COH_EXPORT SafeService
197197
* If the service is not running and has not been explicitly stopped,
198198
* the service is restarted.
199199
*
200-
* @param fDrain if true and the wrapped service is restarted, the
201-
* calling thread will be blocked until the wrapped
202-
* service event dispatcher queue is empty and all
203-
* outstanding tasks have been executed
204-
*
205200
* @return the running wrapped service
206201
*/
207-
virtual ServiceType::View ensureRunningService(bool fDrain) const;
202+
virtual ServiceType::View ensureRunningService() const;
208203

209204
/**
210205
* Ensure that the wrapped service is running before returning it.
211206
* If the service is not running and has not been explicitly stopped,
212207
* the service is restarted.
213208
*
214-
* @param fDrain if true and the wrapped service is restarted, the
215-
* calling thread will be blocked until the wrapped
216-
* service event dispatcher queue is empty and all
217-
* outstanding tasks have been executed
218-
*
219209
* @return the running wrapped service
220210
*/
221-
virtual ServiceType::Handle ensureRunningService(bool fDrain);
222-
223-
/**
224-
* Block the calling thread until the wrapped service event/dispatcher
225-
* queue is empty and all outstanding tasks have been/executed.
226-
*/
227-
virtual void drainEvents() const;
228-
211+
virtual ServiceType::Handle ensureRunningService();
229212

230213
// ----- Object interface -----------------------------------------------
231214

@@ -408,15 +391,9 @@ class COH_EXPORT SafeService
408391
* If the service is not running and has not been explicitly stopped,
409392
* the service is restarted.
410393
*
411-
* @param fDrain if true and the wrapped service is restarted, the
412-
* calling thread will be blocked until the wrapped
413-
* service event dispatcher queue is empty and all
414-
* outstanding tasks have been executed
415-
*
416394
* @return the running wrapped service
417395
*/
418-
virtual ServiceType::Handle ensureRunningServiceInternal(
419-
bool fDrain) const;
396+
virtual ServiceType::Handle ensureRunningServiceInternal() const;
420397

421398
/**
422399
* Stop and catch any exceptions. Provide a log message if stop

include/private/coherence/component/util/Service.hpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
5-
* http://oss.oracle.com/licenses/upl.
5+
* https://oss.oracle.com/licenses/upl.
66
*/
77
#ifndef COH_COMPONENT_SERVICE_HPP
88
#define COH_COMPONENT_SERVICE_HPP
@@ -425,7 +425,7 @@ class COH_EXPORT Service
425425
* Blocked copy constructor.
426426
*/
427427
Service(const Service&);
428-
428+
429429

430430
// ----- Service interface ----------------------------------------------
431431

@@ -465,13 +465,6 @@ class COH_EXPORT Service
465465
*/
466466
virtual void dispatchServiceEvent(ServiceEvent::Id nEvent);
467467

468-
/**
469-
* Block the calling thread until the EventDispatcher Queue is empty
470-
* and all outstanding tasks have been executed. This method is
471-
* mostly called on client threads.
472-
*/
473-
virtual void drainEvents();
474-
475468
/**
476469
* Return a running EventDispatcher.
477470
*

0 commit comments

Comments
 (0)