Comments (5)
I dig some more digging, and found some more information:
Due to limitations in the C API, the Client and it's associated Network can only be initialized and run once per the life of a process. Generally the foundationdb::init function will be enough to initialize the Client. See foundationdb::default_api and foundationdb::builder for more configuration options of the Fdb Client.
Is this why we must drop it explicitly? Something to do with "it's associated Network can only be initialised and run once per the life of a process."
from foundationdb-rs.
I love that this crate exists. Thanks for all your hard work heart
First of all, thank you for the kind words
Which leaves me with two questions:
1. Doesn't Rust call `drop` automatically when `network` goes out of scope - why must I call it manually? 2. What happens if my code panics before calling `drop`?
I think @Speedy37 will have a far better answer than me, as we worked heavily on making boot safe (5d4954a, 8725b6e, 7b5d67e, c53f7f6) but had to revert in the end.
If you could help me understand this better, I'm happy to raise a PR updating the documentation with a deeper description of the motivations and usage recommendations.
That would be awesome to clarify that indeed.
from foundationdb-rs.
I tried multiple times to make boot
safe but always found a way to break it.
Trying to boot
multiples times is already checked and would result in a panic (no undefined behavior here).
The unsafe part is due to undefined behavior occurring if fdb_stop_network() is not called before main exits
You must call this function and wait for fdb_run_network() to return before allowing your program to exit, or else the behavior is undefined.
See Clikengo/foundationdb-rs#202 for details
ie.
forget(network)
process::exit
triggered by another thread- ...
from foundationdb-rs.
Related Issues (20)
- Fix `RESULT_NOT_PRESENT` on directory tests HOT 2
- add a `update_metadata_version`
- Publish `0.6.0` on crates.io HOT 4
- Fix 584458794
- Enable traces on BindingTester
- Add support for `7.1` HOT 1
- Deprecate support for 5.X
- Implement Eq and Hash traits for Subspace HOT 5
- Backport other recipes
- Use `run` in the class-sheduling example
- Query issue HOT 5
- Add clarification about get_range* methods HOT 3
- Issues in the Class Scheduling example (class-scheduling.rs) HOT 4
- Add a `db.run_with_options` methods
- 0.7 could not compile `foundationdb` HOT 2
- Add support for 7.2 HOT 1
- Fix misaligned pointer dereference on Rust beta and nightly HOT 3
- Fix infinite recursion on Display impl
- Bump dependencies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foundationdb-rs.