Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rburgst/sse-jpa-demo
a demo repository showing problems with JPA and SSE
https://github.com/rburgst/sse-jpa-demo
Last synced: 2 days ago
JSON representation
a demo repository showing problems with JPA and SSE
- Host: GitHub
- URL: https://github.com/rburgst/sse-jpa-demo
- Owner: rburgst
- Created: 2018-02-19T16:57:10.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-19T17:05:51.000Z (almost 7 years ago)
- Last Synced: 2024-11-08T17:53:07.121Z (about 2 months ago)
- Language: Java
- Size: 53.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Sample repository showing a problem with JPA and SSE.
### How To
1. Launch the app
```
./gradlew bootRun
```2. Launch the browser with http://localhost:8080
3. Open a 2nd window with http://localhost:8080/metrics and keep an eye on `datasource.primary.active`
4. On the 1st browser window press Submit a couple of times, this will cause a page reload and should cause connections
to get leaked
The main problem seems to be `org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor` which keeps the
JDBC connection open until the SSE socket throws an exception. If we dont try to send any SSEs for a long time
then the connection pool will run out of connections before the first SSE emitter throws an exception and only then gets
cleaned up.This repository serves as an example for https://github.com/spring-projects/spring-boot/issues/12110.