Comments (10)
threadsafe also produce incorrect results
from ruby-thread.
That's normal behavior, you're not doing any locking, your code isn't thread safe.
from ruby-thread.
You are correct. I have the code which doesn't needs locking (say update info for each user and save to file).
It has this strange behavior too. Let's close this now.
from ruby-thread.
Also it does works in plain ruby no matter how much times I run it.
from ruby-thread.
I replaced array with Queue.new and still incorrect in rails case (1 out of 5 runs)
Should be 100000
99922
from ruby-thread.
You're right, it does indeed look like a bug in the pool shutdown, I'm looking into it.
from ruby-thread.
I summarized the code here: https://gist.github.com/edbond/5657089
from ruby-thread.
Thanks. Let me know if I can help.
from ruby-thread.
require 'thread/pool'
a = Queue.new
100.times {
pool = Thread.pool(10)
pool.process { sleep 0.01; a << 1 }
pool.shutdown
}
puts a.length
A smaller testcase, the issue seems to lie with different calls to shutdown, which is why I couldn't see it, it just fails every now and then.
And looking at numbers, less than 20% of the time.
from ruby-thread.
Ok, it should be fixed, I pushed a new version of the gem.
from ruby-thread.
Related Issues (20)
- rescuing Exception in pool.rb HOT 1
- memory leak in Thread::Future HOT 1
- pool.join throws HOT 3
- pool#wait_done exits prematurely HOT 1
- Would tagging releases be possible? HOT 3
- [v0.1.6] Thread dies immediately. HOT 3
- Cannot shutdown thread pool HOT 2
- [v 0.1.6] ThreadError: deadlock; recursive locking HOT 2
- Cannot run methods in pool.process block? HOT 6
- `Thread::Pool::Task` leaks HOT 19
- Exception raised when cancelling future in a pool queue. HOT 3
- A little bit of usage help HOT 5
- Thread pool wait HOT 2
- Should pipe act like an enumerable? HOT 4
- Thread skip or break HOT 3
- Synchronizing writes across threads HOT 4
- exceptions in threads HOT 3
- Following example not worked. HOT 4
- Incorrect comment for Thread::Pool::Task#terminate!
- Use CLOCK_MONOTONIC instead of Time.now
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 ruby-thread.