Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

1024k, guardsize: 0k, detached ERROR in my Java Spring boot aplication

I really dont know what had happened, I have my system in production, is just a web, with backend: Java spring boot, front end: html css js.

[277235.348s][warning][os,thread] Failed to start the native thread for java.lang.Thread "HikariPool-1 connection closer"
[277307.072s][warning][os,thread] Failed to start thread "Unknown thread" - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 0k, detached.
[277307.073s][warning][os,thread] Failed to start the native thread for java.lang.Thread "HikariPool-1 connection closer"
[278910.783s][warning][os,thread] Failed to start thread "Unknown thread" - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 0k, detached.
[278910.784s][warning][os,thread] Failed to start the native thread for java.lang.Thread "HikariPool-1 connection closer"

My application properties:

DATABASE
spring.datasource.url=jdbc:mysql://
spring.datasource.username=root
spring.datasource.password=bs
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

JWT
security.jwt.secret=
security.jwt.issuer=
#La sesion dura una semana
security.jwt.ttlMillis=604800000

I spoke with chatGPT and it said me that I should add this:

spring.datasource.hikari.maximum-pool-size=200
spring.datasource.hikari.minimum-idle=10
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=MyHikariCP
like image 545
SebastianDev Avatar asked Sep 13 '25 06:09

SebastianDev


1 Answers

I had this issue on a Spring boot app running on a K8S pod on AWS. In my case, the pThread error was subsequently resulting in an OOME. I checked out this blog post which indicated that this error likely was because the OS, itself, which was running out of available threads for the app. My K8S pod was going into a crash-loop backoff and restarting. Unfortunately, the pod, which was running in the cloud, wasn't using different hardware.

When I manually scaled down my pod, waited for a few seconds, and scaled the pod back up (which used a new pod/server), my app started up successfully and the problem was resolved because there were now enough OS threads available for the app.

Who would have believed that the ChatGPT solution given above with the question wasn't correct? Sorry, I couldn't resist. ;-) Hopefully, this solution helps others with this issue.

like image 171
entpnerd Avatar answered Sep 14 '25 21:09

entpnerd