I believe the problem is in the function atomic() in lgc.c, at line
531:
531 /* remark objects cautch by write barrier */
532 propagateall(g);
533 /* remark occasional upvalues of (maybe) dead threads */
534 remarkupvals(g);
535 /* remark weak tables */
536 g->gray = g->weak;
537 g->weak = NULL;
Line 534 marks open upvals, which effectively marks the object in the
upval. However, the marks are not propagated, and then the gray list
is wiped out at line 536. (The explanation for remarkupvals is in
Roberto's very useful presentation on Lua's internals.)
Moving the call to propagateall() at line 532 so that it comes after
line 534 seems to solve the problem.