Comments (10)
I've run stackprof on large scale production traffic sites (like this one) without issue. Sounds like there may be a bug in the s3 library you're using, where it doesn't handle EINTR correctly and retry.
Although iirc we are using SA_RESTART so interruptions shouldn't even bubble up in the first place.
from stackprof.
Based on http://man7.org/linux/man-pages/man7/signal.7.html, it sounds like there a variety of functions that are never restarted, regardless of the use of SA_RESTART
. These methods include recv
and send
, which are presumably used under the hood by the S3 library.
from stackprof.
What library is it?
Networking code generally loops around EINTR for this reason.
from stackprof.
https://github.com/aws/aws-sdk-ruby, specifically version 2.8.7
from stackprof.
Do you have a stack trace of the failure?
from stackprof.
The approach in stackprof was copied from gperftools, which google also uses extensively internally. If a library doesn't react well to signal interruption, it's a bug in that library.
Sampling via a thread is an interesting idea. You could do that for wall time profiling, but I'm not sure how cpu profiling would work with a thread. Either way, probably best to implement something like that in a separate project? You could do it with a ruby thread, and there might be something like that already implemented in ruby-prof or other profiler.
from stackprof.
Thanks for the really fast responses, as always :) You're a very helpful maintainer.
I'll try to dig up a stack trace later, and see if I can identify a bug in the S3 library.
If that ends up being a rabbit hole, I'll investigate other profiling libraries.
from stackprof.
Okay, I dug a little further, and on second look, I don't think it has anything to do with S3.
It seems like an interaction with the thread pool being used by https://github.com/chadrem/workers (we parallelize S3 uploads using that library).
require 'workers'
require 'stackprof'
group = Workers::TaskGroup.new
group.add { sleep(1) }
StackProf.run(mode: :wall, interval: 500, raw: true) do
puts group.run
end
puts group.tasks[0].state
I would expect this to output:
true
suceeded
What it actually outputs is
false
running
If I remove the Stackprof.Run
(so the resulting script is just this):
require 'workers'
require 'stackprof'
group = Workers::TaskGroup.new
group.add { sleep(1) }
puts group.run
puts group.tasks[0].state
Then the result is indeed
true
succeeded
I recognize that this is likely a bug with the workers library, and not with stackprof, but just figured I'd post here in case I'm wrong about that, or if you have any insights about the potential cause.
from stackprof.
Found a fix: chadrem/workers#8 (comment)
Closing this now, since this ended up having nothing to do with stackprof
:)
from stackprof.
Nice find. May be worth reporting up to ruby-core too, as it seems CondVar#wait should have more sane behavior here.
from stackprof.
Related Issues (20)
- Problem with Ruby 2.7.6 and version 0.2.20 HOT 6
- Error installing with Ruby 3.1 HOT 3
- Segmentation fault on Ruby 2.7.6p219 HOT 4
- Possibility to filter certain files or classes?
- flaky test failure with ruby3.1
- Test failures on 32bit arch
- Flamegraph way too short in `wall` mode HOT 5
- Support Gecko format? HOT 2
- Weird timestamp deltas with puma HOT 2
- bug: "missed_samples" integer overflow possible HOT 1
- bug: possible state leak of `buffer_count` state between stackprof invocations HOT 2
- C99 error while compiling v0.2.25 HOT 1
- Add marker metadata feature HOT 1
- stackprof fails to build native extensions on ubuntu 22.04 and ruby 3.2.2 HOT 1
- "lines" attribute format?
- bug: state of _stackprof.last_sample_at can leak between invocations
- 3.3.0-dev: Segfault in `rb_profile_frames` with N:M threads enabled HOT 3
- Add discussions tab, hide the projects tab
- ruby 3.2.2 An error occurred while installing stackprof (0.2.26), and Bundler cannot
- Test failure StackProfTest#test_raw Expected 0 to be > 0.
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 stackprof.