All Questions
Tagged with ruby multithreading
1,060
questions
0
votes
0
answers
32
views
Ruby on Rails, threading in DelayedJob workers
I'm working on a Ruby on Rails web project that runs on Puma server, also has several DelayedJob Workers on different servers.
The project generates some special logs that i want to send to AWS Sqs ...
1
vote
0
answers
76
views
ruby: multithreading in a docker container does not work
I tested ractors in ruby with docker and without
this is my script
ractors = []
Benchmark.bm do |x|
x.report("Single thread:") do
cpu_intensive_task
cpu_intensive_task
end
x....
1
vote
0
answers
64
views
Does Ruby have problems with race conditions on local variables when working with threads? [duplicate]
I'm trying to learn more about threads in Ruby
I'm running this code for 10 minutes, and every time I got the same result: index = 480000
def test
threads = []
total_threads = 40000
...
0
votes
0
answers
58
views
Ruby thread.join does not return when using curses gem
I'm trying to get the ruby curses gem to run with multiple threads (on Windows) to run a serial port:
require 'serialport'
require 'curses'
include Curses
init_screen
start_color
curs_set(0)
noecho
$...
1
vote
0
answers
46
views
Why does the order of closing two IO pipes in two forks matter?
Running the following code in Ruby makes Process.wait p1 to hang indefinitely. This is seemingly because r1.eof? in the first subprocess does not get unblocked by w1.close in the parent process.
r1, ...
2
votes
1
answer
104
views
Ruby Thread Pool pausing on ThreadError.queue _empty
I am attempting to write a script that runs over subdirectories and analyze contents. I am using threadpool, which has dramatically improved performance. However, my script is pausing near completion, ...
2
votes
0
answers
100
views
Fastlane concurrent builds
I'm getting an error in my Fastlane setup when I try to run two build lanes concurrently. Here's the relevant code:
lane :builds do
current_directory = Dir.pwd
google_thread = Thread.new { ...
0
votes
1
answer
61
views
Wrapping block of code in ruby Thread object
we need to implement in our gem feature that needs to inject piece of code into Thread.new block statement globally. Let's leave here discussion about why :)
If I define something like:
module ...
6
votes
0
answers
335
views
ActiveRecord- Cannot expire connection
I have the following multithreaded code:
pool.post do
ActiveRecord::Base.connection_pool.with_connection do
process
end
end
where pool is a ThreadPoolExecutor from the concurrent-ruby ...
0
votes
1
answer
295
views
Concurrent Ruby- Thread Pool vs Promises
I currently have some code where I retrieve data from a bunch of URLs. At the moment, I'm doing this sequentially. In order to speed it up, I want to do this concurrently.
To implement this, I'm using ...
2
votes
0
answers
87
views
Ruby crashes when embedded in a child thread
I had hoped this would have been an answer to this, but sadly, its not.
I am trying to run a single copy of ruby inside a child thread and have it communicate with the main thread.
The way the ...
3
votes
0
answers
84
views
Pause embedded ruby interpreter and resume later
I am running an embedded ruby interpreter inside a simulator.
I have wrapped the c api to the simulator so I can call it from ruby.
Unfortunately there is no blocking call to tell the simulator to run,...
0
votes
1
answer
75
views
What's the use of having a loop block inside Thread.new in ruby?
I am a beginner when it comes to multi-threading. I am trying to understand how Thread in ruby works, and saw this example from this website (Thread-safe Data Structures)
require 'thread'
queue = ...
2
votes
1
answer
46
views
Ruby: Data to a file only being written / saved / visible after program terminates
I am running a thread that does a few things.
It gets a float from an API
Appends that number into a file
Prints that number to the command terminal
Repeats
Code:
price_file = File.open(...
0
votes
1
answer
187
views
ruby: object not cleaned by GC when it creates a thread
Class owning a thread doesn't get garbage collected
I have a ruby service that needs to stream an object from S3 to somewhere else, the files get large and I don't want to store them as a file, so I ...