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

Option --starlark_cpu_profile is completely broken on Windows #13748

Closed
konste opened this issue Jul 27, 2021 · 16 comments
Closed

Option --starlark_cpu_profile is completely broken on Windows #13748

konste opened this issue Jul 27, 2021 · 16 comments
Assignees
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) stale Issues or PRs that are stale (no activity for 30 days) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request

Comments

@konste
Copy link

konste commented Jul 27, 2021

Description of the problem / feature request:

--starlark_cpu_profile command-line option crashes Bazel server on Windows.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

For absolutely any Bazel build on Windows adding --starlark_cpu_profile=pprof.gz to the command line causes immediate server failure: Server terminated abruptly (error code: 2, error message: 'Stream removed', log file: 'c:\_\jjgeprbx\server\jvm.out')
jvm.out file mentioned is absolutely empty.
I have verified the problem is present on multiple Windows machines, but does not reproduce on Mac and Linux.

What operating system are you running Bazel on?

Windows 10 20H2

What's the output of bazel info release?

4.1.0, 4.2.0rc1

@konste
Copy link
Author

konste commented Jul 27, 2021

@meteorcloudy could you please take a peek as the Windows expert? It is trivial to repro and broken completely, so I hope it may be a small fix.

@meteorcloudy meteorcloudy self-assigned this Jul 27, 2021
@meteorcloudy meteorcloudy added area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) type: bug labels Jul 27, 2021
@meteorcloudy
Copy link
Member

Thanks for the report! I'll look into it.
/cc @meisterT

@andrewkatson
Copy link
Contributor

andrewkatson commented Jul 27, 2021

I got a stack trace

FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.UnsupportedOperationException: this platform does not support Starlark profiling
	at net.starlark.java.eval.CpuProfiler.start(CpuProfiler.java:131)
	at net.starlark.java.eval.Starlark.startCpuProfile(Starlark.java:963)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:367)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:231)
	at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:547)
	at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:611)
	at io.grpc.Context$1.run(Context.java:579)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

This shouldn't be too bad I'll start working on a solution.

@meteorcloudy
Copy link
Member

Looks like this isn't a bug, but a feature request since the cpu profiler is not yet implemented on Windows.
https://cs.opensource.google/bazel/bazel/+/master:src/main/java/net/starlark/java/eval/BUILD;l=95;bpv=0

@meteorcloudy
Copy link
Member

/cc @brandjon

@meisterT
Copy link
Member

I guess it still shouldn't crash hard

@meteorcloudy
Copy link
Member

IIUC, Andrew is looking into porting cpu_profiler_posix.cc to Windows. If that doesn't work, we'll make it fail gracefully.

@konste
Copy link
Author

konste commented Jul 28, 2021

@andrewkatson could you please comment for me how you got that stack trace?

@andrewkatson
Copy link
Contributor

It was actually in jvm.out!

@konste
Copy link
Author

konste commented Jul 28, 2021

Weird! For me jvm.out was completely empty.

@andrewkatson
Copy link
Contributor

Still working on this! Should have something to test out soon.

@andrewkatson
Copy link
Contributor

Havent gotten the chance to look at this for a bit. Hoping I can do something soon

@andrewkatson
Copy link
Contributor

Okay I've got a solution. I went with just ignoring and logging that the option is unsupported. The windows api lacks key functionality in order to get this information

@konste
Copy link
Author

konste commented Aug 27, 2021

O-oh-h... that's too bad. Even partial functionality cannot be achieved on Windows? What exactly the missing API should do?

@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Sep 21, 2021
@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label May 26, 2023
@github-actions
Copy link

github-actions bot commented Jun 9, 2023

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) stale Issues or PRs that are stale (no activity for 30 days) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request
Projects
None yet
Development

No branches or pull requests

5 participants