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

JpaPersistService.end() doesn't call entityManager.remove() in finally block #694

Open
gissuebot opened this issue Jul 7, 2014 · 4 comments

Comments

@gissuebot
Copy link

From hristo.sabev on March 20, 2012 13:53:45

This is the JpaPersistService.end() method as copied from the source code:

public void end() {
    EntityManager em = entityManager.get();

    // Let's not penalize users for calling end() multiple times.
    if (null == em) {
      return;
    }

    em.close();
    entityManager.remove();
 }

The call to em.close() could fail sometimes. In my particular case it failed because I tried to save an object with byte[] field having more then 500 bytes. This coused the last line to be skipped. Effectively this thread could no longer be used to serve requests because the begin() method of JpaPersistService would always fail.

The fix is to simply surround the em.close() invocation with try-finally block

Original issue: http://code.google.com/p/google-guice/issues/detail?id=694

@gissuebot
Copy link
Author

From cgruber@google.com on March 27, 2012 11:10:49

(No comment was entered for this change.)

Status: Acknowledged
Labels: Extension-Persist Type-Enhancement

@gissuebot
Copy link
Author

From cgruber@google.com on March 27, 2012 11:25:34

(No comment was entered for this change.)

Labels: -Extension-Persist Component-Persist

@gissuebot
Copy link
Author

From maia@lucidfox.org on October 08, 2013 04:31:35

Any chance this will be fixed for 4.0?

@bcass
Copy link

bcass commented Mar 13, 2019

This issue was fixed in version 4.0 as part of issue #597
I believe this is ready to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants