awslabs / awslabs/llmeter

RunConfig.save() crashes with callbacks that have non-serializable state

Open
#94 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
41
Forks
5
Avg merge
2m
Merged PRs (30d)
1

Description

## Problem

`_RunConfig.save()` uses `dataclasses.asdict()` to serialize the run configuration to JSON. `asdict()` internally calls `copy.deepcopy()` on every field value, including the `callbacks` list. Any callback with non-copyable runtime state (e.g. `threading.Event`, `threading.Thread`, file handles, connections) will crash with a `TypeError` during save.

This affects any callback that maintains runtime state beyond simple config values — for example `SystemMetricsMonitor` which uses a background thread and a `threading.Event` for coordination.

## Expected behavior

Saving a run config should serialize only the callback's configuration, not its runtime state. The serialization path should not require `deepcopy` of live objects.

## Resolution

Merging #54 (unified serialization layer) should address this by replacing `asdict()` with `serialize()`, which uses the `__getstate__` protocol as the serialization boundary rather than recursively deepcopying internal state.

Contributor guide

Open the contributing guide

Research direction

Start at `_RunConfig.save()` and inspect how `dataclasses.asdict()` handles the callbacks list. Review the unified serialization layer in #54, especially `serialize()` and the `__getstate__` boundary. Done means saving a callback with non-serializable runtime state serializes its configuration without requiring deepcopy or raising `TypeError`.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.