Summary
importing chicken.errno causes failure in weak-ref test
Metadata
- Id: 0484f3ea5cf692ee462d511c309cb9c81e4f0487
- Trac id:
- Type: defect
- Reporter: felix
- Owner:
- Cc:
- Status: new
- Component: core libraries
- Estimated difficulty: hard
- Resolution:
- Priority: major
- Milestone:
- Version: 6.0.0
- Changetime: 2026-08-09 22:35:08 UTC
- Created: 2026-08-09 22:35:08 UTC
- Keywords: weak-refs
Description
klovett reported problems with this test (weak refs are held, even though they should be released):
{{{
- use_chicken 6 csc -block -strict-types -O3 -d0 min-weak-test.scm
- comment out sexp-comment 4 bug
- #; ;FIXME Creates Strong Refs!
(import (scheme write))
(import
(scheme base) (chicken base) (chicken fixnum) (chicken gc) (srfi 69 hash) (srfi 69 weak fix))
(define ENOUGH 700) ;to trigger a table resize
(let ((ht (make-hash-table #:test equal? #:hash equal?-hash
#:initial 'foo
#:size 500
#:min-load 0.45 #:max-load 0.85
#:weak-keys #t #:weak-values #t)) )
(do ([i 0 (fx+ i 1)]
[kv (gensym) (gensym)]
[kvs '() (cons kv kvs)])
[(fx= i ENOUGH) kvs]
(hash-table-set! ht kv kv))
(gc #t)
;!! The GC Should be Enough
(gc #t)
;?? -size uses same bwp-object? test
(print "Size (after drop & gc): " (hash-table-size ht))
;?? -clean! uses same bwp-object? test
(hash-table-clean! ht)
(print "Size (after hash-table-clean!: " (hash-table-size ht))
) }}}
After some investigation, 47158a51b2d9c3d7dda97d3b88ade8fcddde220b turned out to trigger this behaviour, specifically, the import of (chicken errno).
The exact reason is unclear, but it may be the case, that importing this causes loading of the posix unit, perhaps triggering a GC at just the wrong moment.