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

Don't load documents when dealing with attachments API #160

Closed
metas-rc opened this issue Feb 20, 2017 · 4 comments
Closed

Don't load documents when dealing with attachments API #160

metas-rc opened this issue Feb 20, 2017 · 4 comments
Assignees
Milestone

Comments

@metas-rc
Copy link
Member

Is this a bug or feature request?

  • Bug

What is the current behavior?

  • Sometimes, when calling Receive HUs from the left action menu, you get the following error:

{timestamp: 1487605745759, status: 500, error: "Internal Server Error",…}
error
:
"Internal Server Error"
exception
:
"de.metas.ui.web.window.exceptions.InvalidDocumentStateException"
message
:
"Document /W540196/1000214 state is invalid: already initializing"
path
:
"/rest/api/window/540196/1000214/attachments"
status
:
500
timestamp
:
1487605745759

Which are the steps to reproduce?

  • Create a purchase order, complete it
  • Go to its receipt schedule, to the action menu from the left side (3 points)
  • Receive HUs, Create material receipt (repeat several times)
  • => NOK: You get the error above at a certain point

What is the expected or desired behavior?

  • HU Receiving should work with no error

Check the inspection:
invalid document state exception

@metas-rc metas-rc added this to the 2017-08 milestone Feb 20, 2017
@teosarca
Copy link
Member

stacktrace:


2017-02-20 16:16:55.687  WARN 28790 [  84.232.225.151][        it] --- [http-nio-8080-exec-6] d.m.ui.web.config.WebuiExceptionHandler  : Got REST exception from handler=public java.util.List<de.met
as.ui.web.window.datatypes.json.JSONAttachment> de.metas.ui.web.window.controller.WindowRestController.getAttachments(int,java.lang.String)

de.metas.ui.web.window.exceptions.InvalidDocumentStateException: Document /W540196/1000214 state is invalid: already initializing
        at de.metas.ui.web.window.model.Document.initializeFields(Document.java:342)
        at de.metas.ui.web.window.model.Document.refreshFromSupplier(Document.java:714)
        at de.metas.ui.web.window.model.sql.SqlDocumentsRepository.refresh(SqlDocumentsRepository.java:395)
        at de.metas.ui.web.window.model.sql.SqlDocumentsRepository.refresh(SqlDocumentsRepository.java:371)
        at de.metas.ui.web.window.model.Document.refreshFromRepository(Document.java:1565)
        at de.metas.ui.web.window.model.Document.refreshFromRepositoryIfStaled(Document.java:1574)
        at de.metas.ui.web.window.model.DocumentCollection.getRootDocument(DocumentCollection.java:115)
        at de.metas.ui.web.window.model.DocumentCollection.getDocument(DocumentCollection.java:153)
        at de.metas.ui.web.window.controller.WindowRestController.getAttachments(WindowRestController.java:554)
        at sun.reflect.GeneratedMethodAccessor402.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)


@teosarca
Copy link
Member

solution/workaround: avoid loading the Document while fetching the attachments.

@metas-mk metas-mk modified the milestones: 2017-09, 2017-08 Feb 28, 2017
@teosarca teosarca changed the title InvalidDocumentStateException in Material Receipt Workflow Don't load documents when dealing with attachments API Feb 28, 2017
teosarca added a commit to metasfresh/metasfresh that referenced this issue Feb 28, 2017
* removed attachments from PO because it's not needed
* delete legacy code
* IAttachmentBL methods shall also work with ITableRecordReference
instead of actual model.
teosarca added a commit that referenced this issue Feb 28, 2017
using ITableRecordReference under the hood.
@teosarca
Copy link
Member

Note to IT:

  • regression on Swing, Request's attachments
  • regression on webui: add, delete, browse

teosarca added a commit to metasfresh/metasfresh that referenced this issue Feb 28, 2017
@metas-rc metas-rc self-assigned this Feb 28, 2017
@metas-rc
Copy link
Member Author

Results of IT1

  • Tested on https://w101.metasfresh.com:8443 and w101-metasfresh ( swing version)

  • I stresstested using the steps to reproduce and I didn't get InvalidDocumentStateException any more. I also tryed from other windows: Orders, Invoice candidates. It went all fine. OK

Regression:

  • Tested attachments display, delete, open from both single and grid view. All works fine. OK
  • Tested attachments in Request in both swing and webui. All went fine. OK
  • Tested attachments in Request by attaching in swing and opening/deleting in webui and vice-versa. All went fine. OK

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

3 participants