ring-clojure / ring

Clojure HTTP server abstraction
MIT License
3.77k stars 520 forks source link

An exception is raised when :max-queued-requests is lower than :min-thread when creating a jetty server #354

Closed Akeboshiwind closed 4 years ago

Akeboshiwind commented 5 years ago

I've just updated ring-jetty-adapter from 1.6.3 to 1.7.1 and previously I had :max-queued-requests set to 0 while :max-threads and :min-threads where both set to 64. This now raises an IllegalArgumentException for BlockingArrayQueue, changing :max-queued-requests to 64 stops the error from appearing.

Would it be possible to Raise an exception with a more useful error message, for example ":min-queued-requests must be greater than or equal to :min-threads"? Or possibly the value of :max-queued-requests could be set to :min-threads if it is less than :min-threads.

Akeboshiwind commented 5 years ago

I've created a simple example of the issue here: https://github.com/Akeboshiwind/jetty-error-example/blob/master/src/jetty_error_example/core.clj

weavejester commented 5 years ago

Yes, I'd accept a PR for that.

Akeboshiwind commented 5 years ago

Which option would you prefer? Raising a more useful exception or resetting the value of :max-queued-requests?

I think the second would be better seeing as it requires less knowledge for the user about the jetty-adapter's internals, although it does ignore the setting they've passed in.

weavejester commented 5 years ago

Ah, sorry, I meant for raising a more informative error message.

Akeboshiwind commented 5 years ago

What's happening with this issue then? Will you be making an update to the library when you have time?

weavejester commented 5 years ago

Yes, I'll be making an update to Ring when I have time, but this is pretty far down on my list of priorities.

Akeboshiwind commented 5 years ago

Cool, thanks for the update :)