Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
2fecd42f
Commit
2fecd42f
authored
2 years ago
by
Hannes Feldt
Browse files
Options
Downloads
Plain Diff
Merge branch '
L2SS-960
-fix-unittest-deadlock' into 'master'
Resolve
L2SS-960
"Unit tests deadlock starting python 3.7.5" Closes
L2SS-960
See merge request
!442
parents
233b5bcd
d2ed5158
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!442
Resolve L2SS-960 "Unit tests deadlock starting python 3.7.5"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/clients/tcp_replicator.py
+12
-3
12 additions, 3 deletions
...tioncontrol/tangostationcontrol/clients/tcp_replicator.py
with
12 additions
and
3 deletions
tangostationcontrol/tangostationcontrol/clients/tcp_replicator.py
+
12
−
3
View file @
2fecd42f
import
atexit
from
threading
import
Condition
from
threading
import
Semaphore
from
threading
import
Thread
...
...
@@ -54,7 +54,7 @@ class TCPReplicator(Thread, StatisticsClientThread):
}
def
__init__
(
self
,
options
:
dict
=
None
,
queuesize
=
0
):
super
().
__init__
()
super
().
__init__
(
daemon
=
True
)
self
.
queuesize
=
queuesize
...
...
@@ -162,7 +162,8 @@ class TCPReplicator(Thread, StatisticsClientThread):
self
.
_loop
=
asyncio
.
new_event_loop
()
# Create the input queue
self
.
queue
=
asyncio
.
Queue
(
maxsize
=
self
.
queuesize
,
loop
=
self
.
_loop
)
asyncio
.
set_event_loop
(
self
.
_loop
)
self
.
queue
=
asyncio
.
Queue
(
maxsize
=
self
.
queuesize
)
# When wanting to debug event loop behavior, uncomment this
# self._loop.set_debug(True)
...
...
@@ -178,6 +179,10 @@ class TCPReplicator(Thread, StatisticsClientThread):
# call self._loop.stop()
server_task
.
add_done_callback
(
self
.
_server_start_callback
)
# Register _clean_shutdown to be executed at termination to make
# sure all tcp connections are cleaned up.
atexit
.
register
(
self
.
_clean_shutdown
)
# Keep running event loop until self._loop.stop() is called.
# Calling this will lose control flow to the event loop
# indefinitely, upon self._loop.stop() control flow is returned
...
...
@@ -325,6 +330,10 @@ class TCPReplicator(Thread, StatisticsClientThread):
def
_clean_shutdown
(
self
):
"""
Disconnect clients, stop the event loop and wait for it to close
"""
# Unregister _clean_shutdown to prevent double execution and make
# sure the thread gets cleaned up on stop/join
atexit
.
unregister
(
self
.
_clean_shutdown
)
# The event loop is not running anymore, we can't send tasks to shut
# it down further.
if
not
self
.
_loop
.
is_running
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment