Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0038188
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorhave not tried2018-03-21 11:292018-03-23 21:22
ReportercaristuView Statuspublic 
Assigned Tocaristu 
PriorityhighResolutionfixedFixed in Version3.0PR18Q2
StatusclosedFix in branchFixed in SCM revision922ddf36e81c
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toalostale
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0038188: Concurrency problem when downloading attachments with attachment methods that downloads temp files

DescriptionWhen downloading attachments with attachment methods that downloads temp files, the temporary file generated for an attachment is always generated with the attachment name.

This can cause problems if the same attachment is downloaded by different clients at the same time, as the temporary file is deleted at the end of the processes. Thus, if the temporary file is deleted and there is a client which is downloading the same attachment at that very same moment, it could result in the downloading of an empty/corrupted file.
Steps To ReproduceArtificial test.

0) Install the following module[1] which contains an attachment method which uses temporary files on download. Configure it as the attachment method of the client.

1) Login in Openbravo. Create an attachment in any window.
2) In eclipse, put a breakpoint in this line: https://code.openbravo.com/erp/devel/pi/file/tip/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java#l267 [^]
3) Download the attachment. Stop at the breakpoint.
4) Login in Openbravo using another browser tab.
5) In eclipse, put a breakpoint in this line: https://code.openbravo.com/erp/devel/pi/file/tip/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java#l264 [^]
6) Download the same attachment of step 3. Stop at the breakpoint.
7) Continue the thread stopped at step 3 --> The attachment is correctly downloaded
8) Continue with the thread stopped at step 6 --> ERROR. The attachment is not correctly downloaded (an empty file is downloaded)

[1] https://code.openbravo.com/erp/pmods/org.openbravo.service.integration.amazon.s3 [^]
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0038450 closedcaristu Allow to download attachments in temporary files using the attachment name without concurrency problems 
blocks design defect 0034664 acknowledgedTriage Platform Base multi thread unsafeties 

-  Notes
(0103387)
hgbot (developer)
2018-03-21 13:56

Repository: erp/devel/pi
Changeset: 922ddf36e81c56a1320e2d9b66ecd6c54988be5c
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed Mar 21 13:51:33 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/922ddf36e81c56a1320e2d9b66ecd6c54988be5c [^]

fixes issue 38188: avoid concurrency problems in attachment download

  When using an attachment method that creates a temporary (copy) of an attached file about to be downloaded, that copy is deleted once it has been served. Using the attachment name as the name for this "copied" file can cause concurrency problems when the same attachment is downloaded at the same time by different users.

  To avoid this poblem, now the file to be served will be created in the server with the same name of the file returned by the attachment method. Note that this change does not affect to the name of the file that will be downloaded in the client, which still will be the name of the attachment.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java
---
(0103431)
hudsonbot (developer)
2018-03-22 15:09

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/3e905f6a2434 [^]
Maturity status: Test
(0103456)
hgbot (developer)
2018-03-23 08:52

Repository: erp/devel/pi
Changeset: adf483c880661502b713d122fc638a2e9a26b568
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri Mar 23 08:51:41 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/adf483c880661502b713d122fc638a2e9a26b568 [^]

related to issue 38188: use NIO API to copy the file into the output stream

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java
---
(0103457)
alostale (manager)
2018-03-23 09:05

reviewed
(0103477)
hudsonbot (developer)
2018-03-23 21:22

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/42e5233f5207 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2018-03-21 11:29 caristu New Issue
2018-03-21 11:29 caristu Assigned To => platform
2018-03-21 11:29 caristu Modules => Core
2018-03-21 11:29 caristu Triggers an Emergency Pack => No
2018-03-21 11:29 caristu Steps to Reproduce Updated View Revisions
2018-03-21 11:29 caristu Assigned To platform => caristu
2018-03-21 13:11 caristu Description Updated View Revisions
2018-03-21 13:56 hgbot Checkin
2018-03-21 13:56 hgbot Note Added: 0103387
2018-03-21 13:56 hgbot Status new => resolved
2018-03-21 13:56 hgbot Resolution open => fixed
2018-03-21 13:56 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/922ddf36e81c56a1320e2d9b66ecd6c54988be5c [^]
2018-03-21 13:56 caristu Review Assigned To => alostale
2018-03-22 12:02 alostale Relationship added blocks 0034664
2018-03-22 15:09 hudsonbot Checkin
2018-03-22 15:09 hudsonbot Note Added: 0103431
2018-03-23 08:52 hgbot Checkin
2018-03-23 08:52 hgbot Note Added: 0103456
2018-03-23 09:05 alostale Note Added: 0103457
2018-03-23 09:05 alostale Status resolved => closed
2018-03-23 09:05 alostale Fixed in Version => 3.0PR18Q2
2018-03-23 21:22 hudsonbot Checkin
2018-03-23 21:22 hudsonbot Note Added: 0103477
2018-04-25 15:48 caristu Relationship added related to 0038450


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker