ruby-concurrency / ruby-concurrency/concurrent-ruby
ThreadPoolExecutor#kill: documentation and implementation are out of sync
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Ruby
- Estrellas
- 5.8k
- Forks
- 420
- Merge medio
- 20 h 45 min
- PR fusionados (30 d)
- 4
Descripción
* Operating system: mac
* Ruby implementation: Ruby
* `concurrent-ruby` version: 1.3.4
* `concurrent-ruby-ext` installed: no
* `concurrent-ruby-edge` used: no
The docs for ThreadPoolExecutor#kill suggest that inflight tasks will run to completion.
#kill
Begin an immediate shutdown. In-progress tasks will be allowed to complete but enqueued tasks will be dismissed and no new tasks will be accepted. Has no additional effect if the thread pool is not running.
This (maybe too) simple test suggests the Executor will kill its internal threads and not allow them to finish.
e = Concurrent::ThreadPoolExecutor.new
f = Concurrent::Promises.future_on(e) { sleep 10; puts "I'm alive!" }
sleep 11
I'm alive!
f = Concurrent::Promises.future_on(e) { sleep 10; puts "I'm alive!" }
e.kill
e.shutdown? => true
# future f never completes
The code for #kill in ruby_executor_service.rb:
def kill
synchronize do
break if shutdown?
stop_event.set
ns_kill_execution
stopped_event.set
end
true
end
ns_kill_execution:
def ns_kill_execution
# TODO log out unprocessed tasks in queue
# TODO try to shutdown first?
@pool.each(&:kill)
@pool.clear
@ready.clear
end
and @pool.each(&:kill) concludes with:
def kill
@thread.kill
end
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Compare the ThreadPoolExecutor#kill documentation with the kill and ns_kill_execution methods in ruby_executor_service.rb, including the worker kill behavior shown in the issue. Determine the intended handling of in-progress and queued tasks, then update the implementation or documentation so they agree and verify the observed future behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- ruby
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100