Skip to content

Potential bug in keep_subprocess_alive method: Unexpected behavior when modifying list during iteration - New multiprocess manager #2372

Discussion options

You must be logged in to vote

Since process are deleted and then replaced it should also be sufficient to just replace them. This ensures the remaining elements are kept in place.

So instead of

del self.processes[idx]
process = Process(self.config, self.target, self.sockets)
process.start()
self.processes.append(process)

it should suffice to do

process = Process(self.config, self.target, self.sockets)
process.start()
self.processes[idx] = process

instead.

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@xunhanliu
Comment options

Comment options

You must be logged in to vote
4 replies
@yaelmi3
Comment options

@Kludex
Comment options

Kludex Jun 28, 2024
Maintainer Sponsor

@yaelmi3
Comment options

@xunhanliu
Comment options

Answer selected by Kludex
Comment options

You must be logged in to vote
1 reply
@Kludex
Comment options

Kludex Oct 12, 2024
Maintainer Sponsor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants