Skip to content

troubleshooting dangling proxy objects #125

Open
@memetb

Description

@memetb

Hello, I was just troubleshooting this following strange situation:

async def reaper():
	reaper_simdjson_parser = simdjson.Parser()
	while True:
		await asyncio.sleep(1)

		text = await get_json_payload()
		doc = reaper_simdjson_parser.parse(text)
		*results, status = doc

		for x in results:
			# do something

		# del x # forgetting to explicitly delete x would cause intermittent problems
		del status
		del results
		del doc

the error is this:

    doc = reaper_simdjson_parser.parse(text) 
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "simdjson/csimdjson.pyx", line 435, in csimdjson.Parser.parse
RuntimeError: Tried to re-use a parser while simdjson.Object and/or simdjson.Array objects still exist referencing the old parser.

Perhaps specifying which reference is dangling may be helpful? At the very least putting it in the documentation as a potential gotcha might be helpful.

Thank you for pysimdjson and simdjson in general. Huge fan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions