You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the LangChain documentation with the integrated search.
I used the GitHub search to find a similar question and didn't find it.
I am sure that this is a bug in LangChain rather than my code.
The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
N/A
Error Message and Stack Trace (if applicable)
No response
Description
aconfig_with_context may do blocking calls through the path: aconfig_with_context -> _config_with_context -> step.config_specs -> RunnableLambda.config_specs -> RunnableLambda.deps -> get_function_nonlocals -> inspect.getsource -> inspect.getsourcelines -> inspect.findsource -> linecache.getlines -> linecache.updatecache -> IO.readlines
Since #29200 the impact is minimized. There's also a LRU cache on get_function_nonlocals and linecache does a cache of the source files as it name implies (but inspect.findsource does blocking os.stat calls to see if the linecache needs to be refreshed).
But still, there may be some improvement to do in aconfig_with_context to make it fully async.
It could be:
call asyncio.await(getattr, step, "config_specs")
or introduce an async Runnable.aconfig_specs method with a default implementation returning config_specs and override in RunnableLambda
Checked other resources
Example Code
N/A
Error Message and Stack Trace (if applicable)
No response
Description
aconfig_with_context
may do blocking calls through the path:aconfig_with_context
->_config_with_context
->step.config_specs
->RunnableLambda.config_specs
->RunnableLambda.deps
->get_function_nonlocals
->inspect.getsource
->inspect.getsourcelines
->inspect.findsource
->linecache.getlines
->linecache.updatecache
->IO.readlines
Since #29200 the impact is minimized. There's also a LRU cache on
get_function_nonlocals
andlinecache
does a cache of the source files as it name implies (but inspect.findsource does blocking os.stat calls to see if the linecache needs to be refreshed).But still, there may be some improvement to do in
aconfig_with_context
to make it fully async.It could be:
Runnable.aconfig_specs
method with a default implementation returningconfig_specs
and override inRunnableLambda
This issue was discovered by BlockBuster: see #29043
cc @eyurtsev
System Info
N/A
The text was updated successfully, but these errors were encountered: