question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failing to start on windows

See original GitHub issue

Hi. I’m trying to start this on Windows machine and that resulting in failure.

OS: Windows Server 2016 Datacenter

Java: java version “1.8.0_251” Java™ SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot™ 64-Bit Server VM (build 25.251-b08, mixed mode)

Exception I’m getting: PS C:\java_exporters> java -jar cloudwatch_exporter-0.8.0-jar-with-dependencies.jar 1234 .\us-east-1-ec2-metrics.yml

Exception in thread “main” java.lang.IllegalArgumentException: Unknown signal: HUP at sun.misc.Signal.<init>(Unknown Source) at io.prometheus.cloudwatch.ReloadSignalHandler.start(ReloadSignalHandler.java:12) at io.prometheus.cloudwatch.WebServer.main(WebServer.java:34)

Is it even possible to run this on Windows?

Update

For those folks who land here - this is what you can do:

  1. Clone repository locally

  2. I’ve personally used IntelliJ Idea as I’m super unfamiliar with java.

  3. Comment out //ReloadSignalHandler.start(collector); in WebServer.java

  4. Build the project and make sure there are no issues. IntelliJ Idea should pull all required dependencies for you.

  5. In “project structure” go and create new JAR artifact choosing “From module with dependencies” (make sure proposed path to manifest file looks legit) image

    Note that for some reason default path for manifest wasn’t working properly so I had to store it under a different path: /src/main/resources/META-INF (note: you’ll have to create this path before creating artifacts - this way you can select it when selecting main class file)

  6. Build -> Build Artifacts -> cloudwatch_exporter -> Build

  7. All done. Test it with a simple *.yml file and make sure you’re all set.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
matthiasrcommented, Feb 4, 2022

Reading up on signals in Java (signal chaining, more info on sun.misc.Signal) makes me reconsider whether we should support this at all.

Requiring Windows users to recompile is not a solution.

I see multiple ways to solve this:

Keep the current approach but fix the hard dependency on platforms that support HUP

I don’t know how to best do this. Is it enough to catch the exception and carry on without the signal handler, or are there other JVMs where sun.misc.Signal is not importable at all?

Deprecate and remove the SIGHUP reload support

This seems to be what the Java ecosystem wants us to do – stop trying to mess with operating system signals that are inherently not portable. A possible deprecation path would be to

  1. Emit a clear log line stating that HUP reloads are deprecated and due to being removed whenever one is received (1 version)
  2. Put the handler behind a flag, off by default. Update the log line to be even more dire. (1-2 versions)
  3. Delete the signal handling code
0reactions
mindwcommented, Feb 6, 2022

@matthiasr The second approach get’s my vote. IMHO Less is more 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Windows 10/11 Failure to Start
Unplug all USB devices and disconnect if possible all other hard drives. Then unplug power and remove battery, press and hold Power button...
Read more >
7 Solutions to Fix Windows Failed to Start Windows 7 Error
Reasons for Windows Failed to Start Error · 1. Missing or Corrupted BCD File · 2. Bad or Outdated Driver Issues · 3....
Read more >
Windows 10 Won't Boot? 12 Fixes to Get Your PC Running ...
1. Try Windows Safe Mode · 2. Check Your Battery · 3. Unplug All Your USB Devices · 4. Turn Off Fast Boot...
Read more >
What to Do When Your Computer Won't Start | PCMag
Give It More Power. computer cable ; Check Your Monitor. computer monitor ; Listen for the Beep. motherboard ; Unplug Unnecessary USB Devices....
Read more >
Windows 10 fails to start - Your Windows Guide
How to troubleshoot Windows 10 failed to start · Run the Startup Repair from Advanced Options. · Run System File Checker and DISM...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found