Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profiler does not collect any samples after JavaCall.init() #25371

Open
albertas-jn opened this issue Jan 3, 2018 · 8 comments
Open

Profiler does not collect any samples after JavaCall.init() #25371

albertas-jn opened this issue Jan 3, 2018 · 8 comments

Comments

@albertas-jn
Copy link

After calling JavaCall.init() in JavaCall.jl package, the profiler does not collect any samples anymore until REPL is restarted. Profile.init() returns the same (1000000, 0.001) both before and after the call.

Profile.clear()
@profile sin.(rand(100_000_000))
Profile.print() 
[Prints collected samples]

Profile.clear()
using JavaCall
JavaCall.init()
@profile sin.(rand(100_000_000))
Profile.print() 
WARNING: There were no samples collected. Run your program longer (perhaps by
running it multiple times), or adjust the delay between samples with Profile.init().

--
Julia 0.6.2, JavaCall 0.5.2, Linux (x86_64-pc-linux-gnu)

@StefanKarpinski
Copy link
Member

cc @aviks – seems likely to be a JavaCall issue, but I'm not sure.

@albertas-jn
Copy link
Author

If so, does that mean that packages can silently break core functionality?

@ihnorton
Copy link
Member

ihnorton commented Jan 3, 2018

Based on the JavaCall FAQ, I'm pretty sure this is because JVM installs its own signal handlers which interfere with the signal handlers Julia uses for profiling.

If so, does that mean that packages can silently break core functionality?

Both Julia and Java have FFI. Strictly speaking, there's not much a package can't do within the limits of the kernel. (which on x86 these days is ... well, nevermind).

It would be good to at least detect the situation and report a better error.

x-ref JuliaInterop/JavaCall.jl#71

@vtjnash
Copy link
Member

vtjnash commented Jan 3, 2018

Yeah, I think is pretty much just a limitation of the linux kernel. There's a way to configure the JVM (I forget if its a flag, library, or environment variable) to use signals differently, which may help.

@albertas-jn
Copy link
Author

Strictly speaking, there's not much a package can't do within the limits of the kernel.

So there's no guarantee that some package, or an update of a package, will not cause unrelated code to produce rubbish?

@KristofferC
Copy link
Member

So there's no guarantee that some package, or an update of a package, will not cause unrelated code to produce rubbish?

It depends on what you mean with unrelated, but in general no. A package could e.g. redefine plus to mean minus.

@albertas-jn
Copy link
Author

A package could e.g. redefine plus to mean minus.

Right, but in this case it will not be silent. I'm wondering about cases without any warning.

@StefanKarpinski
Copy link
Member

In general, any code you use might cause your program to do anything. This is not unique to Julia.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants