Ticket #1990 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

GC bug with new embedding API

Reported by: nwellnhof Owned by: whiteknight
Priority: normal Milestone:
Component: embed/extend Version: master
Severity: medium Keywords: api gc packfile
Cc: Language:
Patch status: Platform: all

Description

I recently discovered a GC bug caused by the embedding API rewrite. It can be easily triggered by manually setting a low GC threshold like 64K. The problem is the following code sequence:

Parrot_api_load_bytecode_file (or Parrot_api_wrap_imcc_hack)
some other code that triggers a GC
Parrot_api_run_bytecode

The bytecode PMC returned by Parrot_api_load_bytecode_file and Parrot_api_wrap_imcc_hack is an UnmanagedStruct, so constant PMCs from the packfile (and maybe other things) don't get marked. These functions should return a real PMC that properly marks referenced objects.

Change History

  Changed 3 years ago by whiteknight

  • keywords api gc packfile added
  • platform set to all
  • version changed from 3.0.0 to master
  • component changed from none to embed/extend
  • owner set to whiteknight

This is indeed a problem. In the interim we can probably disable GC until we are ready to execute the bytecode, but in the long term we need IMCC and Parrot_api_load_bytecode to be returning PackFile PMCs, not UnManagedStruct PMCs. I'll look into our options soon.

  Changed 3 years ago by nwellnhof

I added a workaround in my gc_dynamic_threshold branch: 00d27fbb

follow-up: ↓ 4   Changed 3 years ago by bacek

Hello nwllnhof.

Can you cherry-pick this commit to master?

-- Bacek

in reply to: ↑ 3   Changed 3 years ago by nwellnhof

Replying to bacek:

Hello nwllnhof. Can you cherry-pick this commit to master?

Cherry-picked in 1b1f6f7.

  Changed 3 years ago by whiteknight

  • status changed from new to closed
  • resolution set to fixed

This issue is a symptom of the "We need GC-able packfiles" TODO item. We have a suitable workaround for it in master now and haven't seen any more problems related to this specific instance since that time.

I'm closing this ticket, we can track the progress of GC-able packfiles elsewhere.

Note: See TracTickets for help on using tickets.