Hi ,
This is regarding issue on WS Registry Service Client in high concurrency
which seems blocks the AF release.
When reading the content with several threads in AF, i.e two resources
path = /foo/r1 content = 12345
path = /foo/r2 content = 67
For AF guys, when they retrieve r1 and r2 resources, i.e for
r1 - returns 12345
but r2 returns 67*45*
( r2 returns with some values from old resource content. )
When dig deep with Janaka, found that, in server side
org.wso2.carbon.registry.ws.api.WSRegistry maintains single tempFile per
instance. And it get used to maintain the content to pass to client side
inside the DataHolder.
Hence obviously we can expect this issue in a but high concurrency. So as a
solution when creating the data holder we create a copy of the
aforementioned file as follows. And then for multiple requests on the same
ws connection it deals with separate files and issue went away.
But this leads to grow the tmp files in the tmp directory but upon server
downtime those will get vanished.
With the following fix, since files are growing, one option is to do an
additional ws call inside ws-client to server side to clean up the
particular file. But it seems not a best solution.
*So @Senaka @Ajith, Any better solution you can see ? *
Index: src/main/java/org/wso2/carbon/registry/ws/api/utils/CommonUtil.java
===================================================================
--- src/main/java/org/wso2/carbon/registry/ws/api/utils/CommonUtil.java
(revision 204294)
+++ src/main/java/org/wso2/carbon/registry/ws/api/utils/CommonUtil.java
(working copy)
@@ -193,6 +193,9 @@
}
public static DataHandler makeDataHandler(Resource resource, File
tempFile) throws IOException, RegistryException{
+ tempFile = File.createTempFile("wsresource", ".tmp");
+ tempFile.deleteOnExit();
+
if (resource.getContent() == null) {
return null;
}
--
Thanks
/subash
*Subash Chaturanga*
Senior Software Engineer :Platform TG; WSO2 Inc. http://wso2.com
email: [email protected]
blog: http://subashsdm.blogspot.com/
twitter: @subash89
phone: +9477 2225922
Lean . Enterprise . Middleware
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev