Comments (4)
Sorry for a late reply. As far as I see this function continues to check for values even the worker
has exited. gatherFrom
continues to check for values as well, but only while there are no more values in the chan and worker thread is alive.
It seems that such function can exit only with BlockedIndefinitelyOnSTM
if there are no more threads that has a access to the chan
. It feels pretty unsafe and I think that there should be better API for this case, but I may be wrong here. Can you please share the general structure of the code that uses this function, so we can check if it's the best option for the library in such a case?
from stm-conduit.
Hi @qnikst ,
I haven't had a chance to process all of what you said just yet (will try to read into this more soon), but I'm using this in a server context; when I used the original gatherFrom
, it would exit immediately, perhaps because no TCP accept
had been initiated when gatherFrom
initially starts.
Here's how I used it, along with some surrounding context and discussion: google/proto-lens#372 (comment)
from stm-conduit.
Thanks, I'll take a deeper look, but from what I see the problem is that you immediately fork the thread from the worker, and worker exits:
serveTBQ hp port rFun tbq = do
_ <- async $ withRunInIO $ \run -> TCP.serve hp port $ \(csock, addr) -> do
If you don't use async
here then the code will work with gatherFrom
.
from stm-conduit.
@qnikst sorry for taking a while to get back on this. I appreciate the feedback, and yes, that was indeed the issue. Hard to say why I had that async
there in the first place, in retrospect.
from stm-conduit.
Related Issues (20)
- version in github repository (2.5.1) is behind version released on Hackage (2.5.2) HOT 1
- Generalizing Data.Conduit.Async HOT 1
- Tests for 2.6.0 fail to build HOT 4
- mergeSources terminates only after both sources have terminated (?) HOT 2
- mergeSources and brackets HOT 6
- Build failure (GHC 8 related?) HOT 2
- Fell out of stackage HOT 1
- mergeSources is not exception safe. HOT 1
- import Conduit HOT 1
- Deadlock when using `$$&` and the upstream uses `throwError` HOT 1
- Expose `CCatable` class HOT 2
- What is the difference between `mergeSources` and `mergeConduits` ? HOT 4
- remove conduit-combinators in stm-conduit.cabal in branch conduit-1.3 HOT 2
- stm-conduit-3.0.0 does not build against current conduit-combinators package HOT 2
- Feature suggestion: do not use concurrency when buffer count is 0
- Memory leak when using mergeSources HOT 1
- errant line of code in gatherFrom? HOT 5
- Question about terminating gatherFrom in the event of an outer exception HOT 5
- can't build with ghc-9.6.2 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 stm-conduit.