Issue
I'm running a spring boot project in docker and I'm executing the following JDBC code:
SqlRowset rowset = jdbcTemplate.queryForRowSet(queryString);
The query string is the following:
SELECT *
FROM tableName
WHERE timestamp >= '2022-04-03 01:00:00.000000 -0700'
AND timestamp <= '2022-04-13 01:59:59.999999 -0700'
ORDER BY timestamp
LIMIT 2500
OFFSET 0
While executing this query through JDBC the docker container dies and deletes. I have other queries that work fine but for some reason this one that has dates included kills the docker machine. Just wondering if anyone knows why this would be happening?
The last log that gets spit out in the docker container is:
2022-06-20 19:56:00,985 DEBUG org.springframework.jdbc.core.JdbcTemplate :
Executing SQL query
[SELECT * FROM tableName WHERE timestamp >= '2022-04-03 01:00:00.000000 -0300' AND timestamp <= '2022-04-13 01:59:59.999999 -0300' ORDER BY timestamp LIMIT 2500 OFFSET 0]
Solution
I figured out what was wrong. There wasn't enough memory being allocated for the Docker container in my environment file.
I followed the directions in the link @eol provided:
You can try and change the entrypoint to keep the container running even after your spring-app crashes. You should then be able to see what's really going on. Check this for example: Keep Your Docker Container Running for Debugging
I removed our tag to remove the Docker container on a failure.
I SSH'd into the container and did some investigation. I discovered an out-of-memory error in the status "OOMKilled": "true"
. This led me to the conclusion that memory wasn't allocated to the size we needed.
Answered By - jmajcan
Answer Checked By - Katrina (JavaFixing Volunteer)