WIP: fix(alloy): unvendor async-profiler path #109

Closed
janik wants to merge 1 commit from alloy-patch into main
Owner

I know the patch is quite ugly, but I just want to check if this fixes our vendor problem and I don't have the spoons to setup a alloy dev instance.
If the patch works I'll write something nicer, unvendoring as much as possible, and try to upstream it to grafana.

related to #108

I know the patch is quite ugly, but I just want to check if this fixes our vendor problem and I don't have the spoons to setup a alloy dev instance. If the patch works I'll write something nicer, unvendoring as much as possible, and try to upstream it to grafana. related to #108
janik added 1 commit 2024-09-06 09:33:54 +00:00
Author
Owner

Applying the patch causes:

sept. 06 09:49:14 gerrit systemd[1]: Started alloy.service.
sept. 06 09:49:15 gerrit alloy5[846714]: Unknown cmd run
sept. 06 09:49:15 gerrit alloy5[846714]: Unknown cmd /etc/alloy
sept. 06 09:49:15 gerrit alloy5[846714]: Unknown cmd --server.http.listen-addr=127.0.0.1:15555
sept. 06 09:49:15 gerrit alloy5[846714]: Usage: alloy [options] file ...
sept. 06 09:49:15 gerrit alloy5[846714]: // -d/--debug set debug mode
sept. 06 09:49:15 gerrit alloy5[846714]: -h/--help show this help
sept. 06 09:49:15 gerrit alloy5[846714]: -q/--quit do not continue with GUI
sept. 06 09:49:15 gerrit alloy5[846714]: -v/--version show version
sept. 06 09:49:16 gerrit alloy5[846714]: Exception: class java.awt.HeadlessException
sept. 06 09:49:16 gerrit alloy5[846714]: Message: java.awt.HeadlessException:
sept. 06 09:49:16 gerrit alloy5[846714]: No X11 DISPLAY variable was set,
sept. 06 09:49:16 gerrit alloy5[846714]: or no headful library support was found,
sept. 06 09:49:16 gerrit alloy5[846714]: but this program performed an operation which requires it,
sept. 06 09:49:16 gerrit alloy5[846714]: Stacktrace:
sept. 06 09:49:16 gerrit alloy5[846714]: class java.awt.HeadlessException:
sept. 06 09:49:16 gerrit alloy5[846714]: No X11 DISPLAY variable was set,
sept. 06 09:49:16 gerrit alloy5[846714]: or no headful library support was found,
sept. 06 09:49:16 gerrit alloy5[846714]: but this program performed an operation which requires it,
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/sun.awt.HeadlessToolkit.getScreenSize(HeadlessToolkit.java:186)
sept. 06 09:49:16 gerrit alloy5[846714]: edu.mit.csail.sdg.alloy4.OurUtil.getScreenWidth(OurUtil.java:185)
sept. 06 09:49:16 gerrit alloy5[846714]: edu.mit.csail.sdg.alloy4whole.SimpleGUI.(SimpleGUI.java:1996)
sept. 06 09:49:16 gerrit alloy5[846714]: edu.mit.csail.sdg.alloy4whole.SimpleGUI.(SimpleGUI.java:1969)
sept. 06 09:49:16 gerrit alloy5[846714]: edu.mit.csail.sdg.alloy4whole.SimpleGUI$7.run(SimpleGUI.java:1951)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
sept. 06 09:49:16 gerrit alloy5[846714]: java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
sept. 06 09:49:16 gerrit alloy5[846714]: java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

My best guess is that the nixpkgs asprof version is build in a way where it requires a desktop, but I didn't investigate it yet.

(ftr: I already rolled gerrit01 back to main)

Applying the patch causes: > sept. 06 09:49:14 gerrit systemd[1]: Started alloy.service. sept. 06 09:49:15 gerrit alloy5[846714]: Unknown cmd run sept. 06 09:49:15 gerrit alloy5[846714]: Unknown cmd /etc/alloy sept. 06 09:49:15 gerrit alloy5[846714]: Unknown cmd --server.http.listen-addr=127.0.0.1:15555 sept. 06 09:49:15 gerrit alloy5[846714]: Usage: alloy [options] file ... sept. 06 09:49:15 gerrit alloy5[846714]: // -d/--debug set debug mode sept. 06 09:49:15 gerrit alloy5[846714]: -h/--help show this help sept. 06 09:49:15 gerrit alloy5[846714]: -q/--quit do not continue with GUI sept. 06 09:49:15 gerrit alloy5[846714]: -v/--version show version sept. 06 09:49:16 gerrit alloy5[846714]: Exception: class java.awt.HeadlessException sept. 06 09:49:16 gerrit alloy5[846714]: Message: java.awt.HeadlessException: sept. 06 09:49:16 gerrit alloy5[846714]: No X11 DISPLAY variable was set, sept. 06 09:49:16 gerrit alloy5[846714]: or no headful library support was found, sept. 06 09:49:16 gerrit alloy5[846714]: but this program performed an operation which requires it, sept. 06 09:49:16 gerrit alloy5[846714]: Stacktrace: sept. 06 09:49:16 gerrit alloy5[846714]: class java.awt.HeadlessException: sept. 06 09:49:16 gerrit alloy5[846714]: No X11 DISPLAY variable was set, sept. 06 09:49:16 gerrit alloy5[846714]: or no headful library support was found, sept. 06 09:49:16 gerrit alloy5[846714]: but this program performed an operation which requires it, sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/sun.awt.HeadlessToolkit.getScreenSize(HeadlessToolkit.java:186) sept. 06 09:49:16 gerrit alloy5[846714]: edu.mit.csail.sdg.alloy4.OurUtil.getScreenWidth(OurUtil.java:185) sept. 06 09:49:16 gerrit alloy5[846714]: edu.mit.csail.sdg.alloy4whole.SimpleGUI.<init>(SimpleGUI.java:1996) sept. 06 09:49:16 gerrit alloy5[846714]: edu.mit.csail.sdg.alloy4whole.SimpleGUI.<init>(SimpleGUI.java:1969) sept. 06 09:49:16 gerrit alloy5[846714]: edu.mit.csail.sdg.alloy4whole.SimpleGUI$7.run(SimpleGUI.java:1951) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714) sept. 06 09:49:16 gerrit alloy5[846714]: java.base/java.security.AccessController.doPrivileged(AccessController.java:400) sept. 06 09:49:16 gerrit alloy5[846714]: java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) sept. 06 09:49:16 gerrit alloy5[846714]: java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) My best guess is that the nixpkgs asprof version is build in a way where it requires a desktop, but I didn't investigate it yet. (ftr: I already rolled gerrit01 back to main)
janik changed title from fix(alloy): unvendor async-profiler path to WIP: fix(alloy): unvendor async-profiler path 2024-09-06 09:53:08 +00:00
Owner

Is there a reason to still keep this as a WIP or can we merge this?

Is there a reason to still keep this as a WIP or can we merge this?
Owner

Ah this patch is non-functional, right.

Ah this patch is non-functional, right.
Author
Owner

Ah this patch is non-functional, right.

Yeah, I spent way too much time trying to reproduce this but didn't figure it out and wasn't able to reproduce the behavior outside of alloy.

As far as I understand, alloy basically just shells out and executes the async-profiler binary. The async-profiler crashes somewhere in the openjdk code due to class java.awt.HeadlessException.
I tried executing the profiler binary on a headless server with a "clean" environment (using env -i) but that worked as expected. I also made sure to use the same cli flags/args alloy passes to async-profiler, but that didn't help either.
Furthermore, I also tried a multitude of different things, from making sure to use the nixpkgs headless-jdk environment, to setting the jdk vars telling an application to run in headless mode, to building an unwrapped async-profiler version (alloy vendors an unwrapped version of the profiler).

I also poked around the alloy vendoring code in general and am pretty sure I can write an upstreamable patch making it configurable, it's just a bit of toil but isn't actually too complicated except for the weird profiler behavior.

However, it's probably not worth it to invest more time into this problem at the moment if the issue doesn't occur more often, so I'll close the pr for now.

> Ah this patch is non-functional, right. Yeah, I spent way too much time trying to reproduce this but didn't figure it out and wasn't able to reproduce the behavior outside of alloy. As far as I understand, alloy basically just shells out and executes the async-profiler binary. The async-profiler crashes somewhere in the openjdk code due to `class java.awt.HeadlessException`. I tried executing the profiler binary on a headless server with a "clean" environment (using env -i) but that worked as expected. I also made sure to use the same cli flags/args alloy passes to async-profiler, but that didn't help either. Furthermore, I also tried a multitude of different things, from making sure to use the nixpkgs headless-jdk environment, to setting the jdk vars telling an application to run in headless mode, to building an unwrapped async-profiler version (alloy vendors an unwrapped version of the profiler). I also poked around the alloy vendoring code in general and am pretty sure I can write an upstreamable patch making it configurable, it's just a bit of toil but isn't actually too complicated except for the weird profiler behavior. However, it's probably not worth it to invest more time into this problem at the moment if the issue doesn't occur more often, so I'll close the pr for now.
janik closed this pull request 2024-09-18 20:46:44 +00:00
janik deleted branch alloy-patch 2024-09-18 20:47:03 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: the-distro/infra#109
No description provided.