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

VertX error #2702

Open
IBPrivate opened this issue Jan 17, 2025 · 0 comments
Open

VertX error #2702

IBPrivate opened this issue Jan 17, 2025 · 0 comments
Labels

Comments

@IBPrivate
Copy link

IBPrivate commented Jan 17, 2025

Version

Which version(s) did you encounter this bug ?
4.5.10

Context

Unhandled exception in router
I dont know what this causes and I dont know how to get rid of it

Do you have a reproducer?

Nope, thats the problem.

Code:

Vertx vertx = Vertx.vertx();
if (vertx instanceof VertxInternal vertxInternal) {
	BlockedThreadChecker blockedThreadChecker = vertxInternal.blockedThreadChecker();
	
	blockedThreadChecker.setThreadBlockedHandler(event -> {
		final String message = "Thread Thread[" + event.thread().getName() + "," + event.thread().getPriority() + "," + event.thread().getThreadGroup().getName() + "] has been blocked for " + (event.duration() / 1_000_000) + " ms, time limit is " + (event.maxExecTime() / 1_000_000) + " ms";
		
		RuntimeException rte = new RuntimeException(message);
		rte.setStackTrace(event.thread().getStackTrace());
		rte.printStackTrace();
	});
}

Router router = Router.router(vertx);
router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx))
	.setSessionCookieName("session")
	.setCookieSameSite(CookieSameSite.LAX)
	.setCookieSecureFlag(true)
);
router.routeWithRegex("/files/.*").handler(this::handleFileRequests);
router.route().handler(BodyHandler.create().setBodyLimit(-1)).handler(this::handleRequests);
router.route().failureHandler(routingContext -> {
	Throwable failure = routingContext.failure();
	if (failure != null) {
		Web.log("Folgender Fehler ist aufgetreten: " + failure.getMessage());
		failure.printStackTrace();
	} else {
		Web.log("Unbekannter Fehler aufgetreten.");
		Web.log("Anfrage URL: " + routingContext.request().absoluteURI());
		Web.log("Requested URL: " + routingContext.request().path());
		Web.log("HTTP-Methode: " + routingContext.request().method());
		Web.log("Header: " + routingContext.request().headers());
		Web.log("Body: " + routingContext.body().asString());
		Web.log("Port: " + port);
			String forwards = routingContext.request().headers().get("X-Forwarded-For");
		String ip;
		if (StringUtils.isNotBlank(forwards)) {
			ip = StringUtils.substringBefore(forwards, ",");
		} else {
			ip = routingContext.request().remoteAddress().host();
		}
		Web.log("IP: " + ip);
			if (routingContext.request().authority() != null) {
			boolean isHttps;
			if (routingContext.request().headers().contains("X-Forwarded-Proto")) {
				isHttps = routingContext.request().headers().get("X-Forwarded-Proto").equalsIgnoreCase("https");
			} else {
				isHttps = routingContext.request().isSSL();
			}
			Web.log("Host: " + ((isHttps ? "https://" : "http://")) + routingContext.request().authority().host());
		}
	}
	routingContext.response().setStatusCode(404).end();
});

vertx
	.createHttpServer()
	.requestHandler(router)
	.exceptionHandler(error -> {
	})
	.listen(port, handler -> {
	});

Unbekannter Fehler aufgetreten.
Anfrage URL: http://www.shadowserver.orgwww.shadowserver.org:443
Requested URL: www.shadowserver.org:443
HTTP-Methode: CONNECT
Header: Host=www.shadowserver.org
User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0\nConnection=Keep-Alive\nPragma=no-cache\nProxy-Connection=Keep-Alive
Body: null
Port: 8000
IP: censored
Host: http://www.shadowserver.org
Unhandled exception in router

I dont even know what shadowserver is...

@IBPrivate IBPrivate added the bug label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant