Better testing for finalization
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia con la specifica di finalizer proposta in questa issue e verifica il comportamento descritto in jruby/jruby#7267. Determina come la suite possa esercitare la finalizzazione attivata da GC e isolare l'output degli avvisi; il lavoro è completato quando è presente la copertura per la finalizzazione eventuale e per il caso in cui le eccezioni in un finalizer non influenzino quello successivo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
While attempting to write a spec for jruby/jruby#7267 I ran into various issues and questions...
- There are no specs testing that GC eventually finalizes objects. This is obviously difficult to predict, but it is behavior I believe we should be testing one way or another.
- I was testing that exceptions in one finalizer are not seen by the next finalizer, but could not figure out a way to eliminate the warning output from Ruby indicating that a finalizer raised an exception.
The spec I attempted is below, but only makes a best attempt at forcing GC-oriented finalization and still does not suppress the error output.
it "hides raised exceptions from one finalizer to the next" do
def scoped(result)
Proc.new { result << "ok" if $!.nil?; raise }
end
def test(result)
obj = "Test"
# finalizer order may vary so both handlers check $! and raise an error
ObjectSpace.define_finalizer(obj, scoped(result))
ObjectSpace.define_finalizer(obj, scoped(result))
end
result = []
begin
old_verbose, $VERBOSE = $VERBOSE, false
test(result)
ensure
$VERBOSE = old_verbose
end
100.times { GC.start; break if result.size == 2 }
result.should == ["ok", "ok"]
end
I don't want to leave the fix for jruby/jruby#7267 untested, but I'm unsure how we should move forward to improve the GC-triggered finalization specs.
- Lingua principale
- Ruby
- Stelle
- 622
- Fork
- 402
- Merge medio
- 14h 51m
- PR unite (30g)
- 6
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ruby/spec
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
-
Improving Marshal specs Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
palladius/rails8-app-on-gcp#145 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
rubocop/rubocop-rspec#2236 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
riscv/riscv-unified-db#2624 · 1 reazione ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100