Open morgan9e opened 3 weeks ago
This is really difficult to get right, but there are two places where it uses an entropy call:
ahash::AHashMap
is constructed, ahash::RandomState
makes an entropy call.I wonder why we get different results when you run it than in our test suite.
@hoodmane: This is really difficult to get right, but there are two places where it uses an entropy call:
1. the first time pyo3 makes a std::collections::HashMap, it initializes [std::collections::hash_map::RandomState](https://doc.rust-lang.org/std/collections/hash_map/struct.RandomState.html) 2. pydantic-core itself uses [ahash](https://github.com/tkaitchuck/aHash/blob/master/src/hash_map.rs) and the first time an `ahash::AHashMap` is constructed, `ahash::RandomState` makes an entropy call.
I wonder why we get different results when you run it than in our test suite.
But even when I download latest build from
runs/9421919278/job/25957049626, workerd
and run ../workerd serve ./samples/pyodide-fastapi/config.capnp --verbose
, I get
File "/lib/python3.12/site-packages/_cloudflare/import_patch_manager.py", line 27, in exec_module
with self.import_context(module):
File "/lib/python312.zip/contextlib.py", line 144, in __exit__
next(self.gen)
File "/lib/python3.12/site-packages/_cloudflare/entropy_import_context.py", line 123, in pydantic_core_context
with allow_bad_entropy_calls(1):
File "/lib/python312.zip/contextlib.py", line 144, in __exit__
next(self.gen)
File "/lib/python3.12/site-packages/_cloudflare/entropy_import_context.py", line 48, in allow_bad_entropy_calls
raise RuntimeError(
RuntimeError: 1 unexpected leftover getentropy calls
So either its my local environment problem, or Pydantic-core has modified with version change?
I've tested Debian 12, Ubuntu 22.04, and Fedora 39.
Well we are testing this in our downstream internal test suite with this version of pydantic. I'm not sure what the reason for the discrepancy is I'll have to look into it. I added this logic because otherwise the test suite didn't pass. We should try to move more tests into the public repo so we have something to talk about.
Thanks, Then I'll try to look at pydantic-core for now if anything happened there.
While running workerd with Python pydantic package, initilazing error
RuntimeError: 1 unexpected leftover getentropy calls
occurs. Seems fixing it into 0 getentropy call fixes problem, pydantic-core package doesnt consumes entropy?Version is Pydantic-core 2.16.2
Or am I using wrong version of Python or Pyodide?