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

HTTP 503 when running --cache #283

Open
tomdkloss opened this issue Feb 18, 2025 · 2 comments
Open

HTTP 503 when running --cache #283

tomdkloss opened this issue Feb 18, 2025 · 2 comments

Comments

@tomdkloss
Copy link

Hello,

since a few months, i can't run a full cache update with vulnz. We usually run this in a docker container but for sake of simplicity i tried to run it on my machine directly using the following parameters:

java -jar .\vulnz-7.2.2.jar cve --cache --directory .\data

(yes, without an API-Key)

This results in this stacktrace:

` java -jar .\vulnz-7.2.2.jar cve --cache --directory .\data
_/
_/ _/ / / / /// ////
_/ _/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/
/ /// _/ / / ////

Version: 7.2.2

Open Vulnerability Project
? Sponsor: https://github.com/sponsors/jeremylong

NVD_API_KEY not found. Supply an API key for more generous rate limits

NVD API request failures are occurring; retrying request for the 5th time

NVD API request failures are occurring; retrying request for the 6th time

NVD API request failures are occurring; retrying request for the 7th time

NVD API request failures are occurring; retrying request for the 8th time

NVD API request failures are occurring; retrying request for the 9th time

NVD API request failures are occurring; retrying request for the 10th time

NVD API request failures are occurring; retrying request for the 11th time

Retrying request /rest/json/cves/2.0?resultsPerPage=2000&startIndex=18000 : 3rd time

Recoverable I/O exception (org.apache.hc.core5.http.ConnectionClosedException) caught when processing request to {s}->https://services.nvd.nist.gov:443

Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@5229624b[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@17a47605[Wrapped task = org.apache.hc.client5.http.impl.async.InternalAbstractHttpAsyncClient$ScheduledRequestExecution@3e74cae6]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@797cf65c[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 12]
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@5229624b[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@17a47605[Wrapped task = org.apache.hc.client5.http.impl.async.InternalAbstractHttpAsyncClient$ScheduledRequestExecution@3e74cae6]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@797cf65c[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 12]
at java.base/java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2081)
at java.base/java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:841)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:340)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:562)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor.execute(ScheduledThreadPoolExecutor.java:705)
at java.base/java.util.concurrent.Executors$DelegatedExecutorService.execute(Executors.java:754)
at org.apache.hc.client5.http.impl.async.InternalAbstractHttpAsyncClient.executeScheduled(InternalAbstractHttpAsyncClient.java:387)
at org.apache.hc.client5.http.impl.async.InternalAbstractHttpAsyncClient$1.scheduleExecution(InternalAbstractHttpAsyncClient.java:137)
at org.apache.hc.client5.http.impl.async.AsyncHttpRequestRetryExec$1.failed(AsyncHttpRequestRetryExec.java:187)
at org.apache.hc.client5.http.impl.async.AsyncProtocolExec$1.failed(AsyncProtocolExec.java:295)
at org.apache.hc.client5.http.impl.async.HttpAsyncMainClientExec$1.failed(HttpAsyncMainClientExec.java:131)
at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamHandler.failed(ClientHttp1StreamHandler.java:285)
at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamDuplexer.disconnected(ClientHttp1StreamDuplexer.java:220)
at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.onDisconnect(AbstractHttp1StreamDuplexer.java:409)
at org.apache.hc.core5.http.impl.nio.AbstractHttp1IOEventHandler.disconnected(AbstractHttp1IOEventHandler.java:95)
at org.apache.hc.core5.http.impl.nio.ClientHttp1IOEventHandler.disconnected(ClientHttp1IOEventHandler.java:41)
at org.apache.hc.core5.reactor.ssl.SSLIOSession$1.disconnected(SSLIOSession.java:247)
at org.apache.hc.core5.reactor.InternalDataChannel.disconnected(InternalDataChannel.java:204)
at org.apache.hc.core5.reactor.SingleCoreIOReactor.processClosedSessions(SingleCoreIOReactor.java:231)
at org.apache.hc.core5.reactor.SingleCoreIOReactor.doTerminate(SingleCoreIOReactor.java:106)
at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:93)
at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
at java.base/java.lang.Thread.run(Thread.java:1583)

Unable to complete NVD cache update due to error: NVD Returned Status Code: 503
io.github.jeremylong.vulnz.cli.cache.CacheException: Unable to complete NVD cache update due to error: NVD Returned Status Code: 503
at io.github.jeremylong.vulnz.cli.commands.CveCommand.downloadAllUpdates(CveCommand.java:385)
at io.github.jeremylong.vulnz.cli.commands.CveCommand.processRequest(CveCommand.java:274)
at io.github.jeremylong.vulnz.cli.commands.CveCommand.timedCall(CveCommand.java:246)
at io.github.jeremylong.vulnz.cli.commands.TimedCommand.call(TimedCommand.java:36)
at io.github.jeremylong.vulnz.cli.commands.TimedCommand.call(TimedCommand.java:25)
at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
at picocli.CommandLine.execute(CommandLine.java:2174)
at io.github.jeremylong.vulnz.cli.Application.run(Application.java:85)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:765)
at org.springframework.boot.SpringApplication.lambda$callRunners$2(SpringApplication.java:749)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:744)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1289)
at io.github.jeremylong.vulnz.cli.Application.main(Application.java:70)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)

Completed in 299 seconds`

If i run it with an API-Key, it's just stuck for hours on the line after sponsor and does not anything.

I've read in a previous issue, that there were problems at NVD's site in November but for me it's hard to believe that these issues still persist in February, especially because the "Old" Nist-data-mirror still allows me to pull CVE's daily.

Can you please elaborate.

@EugenMayer
Copy link
Contributor

Those are in fact issues with the NVD API, mostly on there side, but also due to the parameters used with the current fetch. The NVD API is fairly fragile (for more then some days), but it becomes even more faulty when the requested fetch uses a huge page size, big range and so on. I had the very same issues, I could never complete a full fetch since weeks using the current client. That is why implemented #279

Still, e.g. today, you will need to run the new implementation for several hours. It will slowly crawl up the years on and on until it looks like this:

│ 10.1.0.31 - - [18/Feb/2025:09:08:52 +0000] "GET / HTTP/1.1" 200 3285                                                                                                                                                                                                                                                     │
│ NVD API request failures are occurring; retrying request for the 6th time                                                                                                                                                                                                                                                │
│                                                                                                                                                                                                                                                                                                                          │
│ NVD API request failures are occurring; retrying request for the 7th time                                                                                                                                                                                                                                                │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Fetched 11 new entries***                                                                                                                                                                                                                                                                                       │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO Stored 24737 entries in nvdcve-modified.json.gz as recent changed items across all years                                                                                                                                                                                                                            │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Uost-recent-changed-cache updated successfully                                                                                                                                                                                                                                                                  │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2002 - not older then 8 days ( Mon, 17 Feb 2025 08:12:22 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2003 - not older then 8 days ( Mon, 17 Feb 2025 08:13:43 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2004 - not older then 8 days ( Mon, 17 Feb 2025 08:15:00 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2005 - not older then 8 days ( Mon, 17 Feb 2025 08:16:22 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2006 - not older then 8 days ( Mon, 17 Feb 2025 07:35:10 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2007 - not older then 8 days ( Mon, 17 Feb 2025 07:38:41 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2008 - not older then 8 days ( Mon, 17 Feb 2025 08:18:46 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2009 - not older then 8 days ( Mon, 17 Feb 2025 08:20:00 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2010 - not older then 8 days ( Mon, 17 Feb 2025 08:21:21 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2011 - not older then 8 days ( Mon, 17 Feb 2025 07:45:22 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2012 - not older then 8 days ( Mon, 17 Feb 2025 07:47:15 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2013 - not older then 8 days ( Mon, 17 Feb 2025 08:24:06 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2014 - not older then 8 days ( Mon, 17 Feb 2025 07:52:05 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2015 - not older then 8 days ( Mon, 17 Feb 2025 07:54:47 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2016 - not older then 8 days ( Mon, 17 Feb 2025 07:56:47 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2017 - not older then 8 days ( Mon, 17 Feb 2025 08:01:03 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2018 - not older then 8 days ( Mon, 17 Feb 2025 09:09:17 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2019 - not older then 8 days ( Mon, 17 Feb 2025 08:08:02 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2020 - not older then 8 days ( Mon, 17 Feb 2025 08:33:22 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2021 - not older then 8 days ( Mon, 17 Feb 2025 17:15:18 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2022 - not older then 8 days ( Mon, 17 Feb 2025 18:02:18 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2023 - not older then 8 days ( Mon, 17 Feb 2025 18:12:01 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2024 - not older then 8 days ( Mon, 17 Feb 2025 17:51:10 GMT )***                                                                                                                                                                                                                                 │
│                                                                                                                                                                                                                                                                                                                          │
│ INFO *** Skipping year 2025 - not older then 8 days ( Tue, 18 Feb 2025 07:50:24 GMT )***  

So no matter what you do, the API is 503ing all over the place. Key is to take smaller results and save them, and then retry

@tomdkloss
Copy link
Author

@EugenMayer thanks for your reply! I'll try to use your image now and see if i can build a successful cache now.

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

2 participants