-
Notifications
You must be signed in to change notification settings - Fork 200
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
Invalid HTTP method: X-Takes-LocalAddress #1227
Comments
@yegor256 Do you have any idea of this error ? |
@baudoliver7 do you know how can I reproduce it? |
@yegor256 It is a bit difficult to reproduce it. It generally happens when I query a GET method on my local machine. It doesn't happen on a distant server. |
We are probably encountering the same issue in production, for a couple of POST requests we do every day and which are exactly identical every day. However, sometimes, one of the requests fails. In these cases, I was able to replicate the problem locally by hammering the service using curl in an infinite loop (but serially, one after the other, never concurrently):
Example stack trace:
|
I've stripped the problem down a bit further, while still being able to reproduce the above stack trace.
This is the code that reproduces the above error, and the takes version is 1.19: public class Main {
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss.SSS");
private static volatile long lastLogTime = System.nanoTime();
private static final AtomicLong postCount = new AtomicLong(0);
private static final Collection<Fork> CONTROLLERS = List.of(
new FkRegex("/a", new TkFork(new FkMethods("POST", req -> {
long now = System.nanoTime();
long postCount = Main.postCount.incrementAndGet();
if (now - lastLogTime > 1_000_000_000) {
System.out.println(LocalTime.now().format(FORMATTER) + " " + postCount + " POST requests");
lastLogTime = now;
}
return new RsText("ok");
})))
);
public static void main(String[] args) throws IOException {
new FtBasic(new TkFork(CONTROLLERS), 8100).start(Exit.NEVER);
}
} The curl command I use (fish shell) is this: while curl --fail-with-body -sX POST 'http://192.168.1.21:8100/a'; end |
@pnatashap maybe you can help with this? |
Meanwhile I have tried once more to replicate this stripped down version with Linux, but I wasn't able to. I tried > 1.3M times with OpenJDK 17.0.1, and >1M times with 11.0.22, and actually this time around I did it concurrently, due to reasons of patience, but I just cannot seem to get it to replicate on Linux (Ubuntu 22.04, 5.15.0-101-lowlatency #111-Ubuntu SMP PREEMPT) |
Another difference I should mention: The (Windows) machines I could replicate this on are both virtual machines. Production is on an AWS EC2, the other Windows machine runs on VirtualBox on a Linux host. The machines I were not able to replicate it on are all physical (x64 in the case of Linux and arm64 (Apple M2) in the case of Mac). Not sure this fact is relevant in this case, but some hypervisors show e.g. clock issues in guests, so TSC time can jump backwards, which is but one thing differentiating virtual from physical machines. |
I just replicated the issue with the latest stable takes 1.24.4, on the same Windows machine: Once after 36k requests, another time after 14k requests, and once it took 193k requests! |
Here's a really short version that still replicates the problem (again on Windows, using takes 1.24.4; this time around, it took 35k attempts, in 237 seconds): public static void main(String[] args) throws IOException {
new FtBasic(new TkFork(new FkRegex("/a", "k")), 8100).start(Exit.NEVER);
} The exception:
|
@yegor256 |
@yegor256 I guess there won't be an "official" hotfix for 1.19? (This is the version we are using in production) |
@EugenDueck yes, we don't do backporting in this project. We'll most probably fix this issue and then release 1.24.5. Is it a problem? |
@yegor256 Totally understand that. |
@yegor256 I have just added a regression test to the PR, which replicates the problem in an unfixed version of takes. |
@baudoliver7 On what OS did this issue occur for you? Also, what JDK version? If you remember. |
@EugenDueck It occurs on Windows with JDK 8 |
(cherry picked from commit a3fd77e)
I got this error sometimes with the current version of Takes :
While debugging, we got this:
It looks like
RqRequestLine.Base
doesn't do the right job :-(The text was updated successfully, but these errors were encountered: