# Fdb and monkey\_patch aware

**URL:** <https://forums.foundationdb.org/t/fdb-and-monkey-patch-aware/3048>\
**Category:** Using FoundationDB\
**Created:** [November 30, 2021, 10:51am UTC](https://forums.foundationdb.org/t/fdb-and-monkey-patch-aware/3048 "2021-11-30T10:51:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![laita](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@laita](https://forums.foundationdb.org/u/laita)\
**Post date:** [November 30, 2021, 10:51am UTC](https://forums.foundationdb.org/t/fdb-and-monkey-patch-aware/3048/1 "2021-11-30T10:51:36Z")

</div>

I use fdb with python binding and I use it in python project where we monkey\_patch gevent.Theres is an issue when monkey\_patching threads with fdb as reported in this thread :

> <https://github.com/apple/foundationdb/issues/228>
>
> Hiya,
> 
> We make use of gevent's \`monkey.patch\_all\` functionality in order to ma…ke all of the pure-Python libraries play nicely with gevent. This is pretty successful, but it currently causes the fdb network thread to block the main application thread.
> 
> Demo: https://gist.github.com/zorkian/824e86d0d7f001965f62dc8ae7ad28db
> 
> This is tested in gevent 1.1.1 as well as the latest 1.3b1.
> 
> You can alleviate the blocking by using \`gevent.monkey.patch\_all(thread=False)\`, but this currently doesn't work in our environment due to certain modules we use that aren't implemented to use gevent and require threading.
> 
> I've been playing around with the fdb library to see if I can make it work, but haven't succeeded as yet. Figured I'd file the issue just to put it on the radar.

To sum up : fdb hangs if we use this conf:  
gevent.monkey.patch\_all(os=False) but works if we set thread to False  
gevent.monkey.patch\_all(os=False, thread=False)

My question is it possible to make fdb library monkey\_patch aware or make some changes on impl.py to make it working with monkey\_patching threads?

Thank you
