Comments (3)
Seconding this, this is extremely frustrating as it also ignores any timeout functionality.
from poem.
The code, you're referring to, doesn't look like a reason.
Yes, loop
is stopped once signal
is received.
But any accepted connection is spawned in separate task (tokio::spawn
), and there is no any async
calls before spawn
, thus select
won't prevent sync code to be executed. So this part will be called anyway (just in background by spawned task):
if alive_connections.fetch_sub(1, Ordering::Acquire) == 1 {
// We have to notify only if there is a registered waiter on shutdown
notify.notify_waiters();
}
And new connections won't be accepted, since loop is stopped. It also uses timeout_token
- so once signal is received, all spawned connections will be dropped within the passed timeout
to run_with_graceful_shutdown
.
Do you use the timeout? Because otherwise connection may just be alive.
from poem.
However I see possible race condition 🤔
notify_waiters()
will notify only already registered waiters
Thus if it's called after alive_connections.load(Ordering::Acquire) > 0
, but before notify.notified()
- it might be never notified.
But we also can't use notify_one
(as is) which stores state that it's notified. Because alive_connections
may reach 0
before shutdown and go up again (i.e there is no connection, but server is alive). It was described here
I filled a new PR to address this scenario: #780 and another one also related to graceful shutdown #779
from poem.
Related Issues (20)
- In poem_openapi, allow a Query to have additional parameters HOT 2
- poerm_grpc: Use metadata of Status structure in headers HOT 1
- Reject requests from URIs with a fragment HOT 1
- poem 3.0.0 performance downgrade HOT 1
- the CompressionAlgo::BR algo is very, very slow > 11s HOT 2
- Poem compression does not take into account the "relative quality factor of the response" ( q=xxx )
- Poem OpenAPI Cookie SecurityScheme ignores provided `key_name`
- Misuse of span.record in tracing middleware HOT 2
- Dependency hell: poem fails to build when `hyper-util 0.1.1` is selected
- Union doesn't support generics in the last version HOT 1
- Union doesn't implement `IsObjectType` HOT 1
- Add CookieConfig to Csrf middleware
- static files performance is weird. Does I missing something?
- Acme-alpn does not work
- Multiple 200 OK options?
- Add Typed Multipart Data Extractor to Poem
- Moving from `serde_json` to faster json parser lib
- Transform errors when extract parameters HOT 1
- poem-lambdaV5.0.0 AWS API Gateway triggering lambda is not supported?
- poem-openapi 5.0.1 is incompatible with poem-openapi-derive 5.0.0 HOT 1
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 poem.