You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sadhana Jain <Sa...@rovicorp.com> on 2009/12/05 02:14:55 UTC
Race condition when using UriInfo to get baseUri value
Hi,
We are using the UriInfo object to getBasrUri() and using UriBuilder to
build and create linked URIs for our rest based services.
However, we are seeing a strange race condition:
We send a request to say host http://192.168.1.102:9000
and then send a ping request to say http://localhost:9000 where both
requests are going to the same host but different addresses, the
UriInfo object returns the base uri of the second request instead of the
first one. So, it seems the UriInfo or message object is somehow
Being shared between threads.
Following is the log that shows the problem 9 I have hightlighted the
hostname and thread numbers.
[INFO ][17:05:02,258][::][v()][t(http-9000-2)]
[
gwy.ws.jaxrs.ElaborationProcessor.handleRequest(ElaborationProcessor.java:12
9) ]
---- elaboration map: {host=192.168.1.102:9000, gateway-version=1.2.11-2,
reply=json, user-agent=curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3
OpenSSL/0.9.7l zlib/1.2.3, Accept=*/*}
[INFO ][17:05:02,257][::][v()][t(http-9000-1)]
[
gwy.ws.jaxrs.ElaborationProcessor.handleRequest(ElaborationProcessor.java:12
9) ]
---- elaboration map: {host=localhost:9000, gateway-version=1.2.11-2,
reply=json, user-agent=curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3
OpenSSL/0.9.7l zlib/1.2.3, Accept=*/*}
[DEBUG][17:05:02,258][::][v()][t(http-9000-2)]
[
gwy.ws.jaxrs.ElaborationProcessor.handleRequest(ElaborationProcessor.java:14
7) ]
---- request method: GET
[DEBUG][17:05:02,258][::][v()][t(http-9000-1)]
[
gwy.ws.jaxrs.ElaborationProcessor.handleRequest(ElaborationProcessor.java:14
7) ]
---- request method: GET
[DEBUG][17:05:02,259][::][v()][t(http-9000-2)]
[ gwy.ws.jaxrs.UriInfoManager.setUi(UriInfoManager.java:51) ]
---- setUi() beging UriInfo base URI: http://localhost:9000/domain
[DEBUG][17:05:02,259][::][v()][t(http-9000-1)]
[ gwy.ws.jaxrs.UriInfoManager.setUi(UriInfoManager.java:51) ]
---- setUi() beging UriInfo base URI: http://localhost:9000/domain
Any help is much appreciated.
Please let me know if I can supply more info.
Thanks,
Sadhana
RE: Race condition when using UriInfo to get baseUri value
Posted by Sergey Beryozkin <sb...@progress.com>.
Hi Sadhana
Yes please, some more information/clarification would help.
Do 192.168.1.102 && localhost identify the same host in your particular
case ?
"We send a request to say host http://192.168.1.102:9000
and then send a ping request to say http://localhost:9000 where both
requests are going to the same host but different addresses"
I need some more details please. Does gwy.ws.jaxrs.ElaborationProcessor
delegates to gwy.ws.jaxrs.UriInfoManager ? Are these 2 beans share the
same jaxrs:server endpoint ? Does gwy.ws.jaxrs.ElaborationProcessor
shows http://192.168.1.102:9000 with UriInfo.getBaseUri() but when it
delegates to
gwy.ws.jaxrs.UriInfoManager it shows localhost ?
cheers, Sergey
-----Original Message-----
From: Sadhana Jain [mailto:Sadhana.Jain@rovicorp.com]
Sent: 05 December 2009 01:15
To: users@cxf.apache.org
Subject: Race condition when using UriInfo to get baseUri value
Hi,
We are using the UriInfo object to getBasrUri() and using UriBuilder to
build and create linked URIs for our rest based services.
However, we are seeing a strange race condition:
We send a request to say host http://192.168.1.102:9000
and then send a ping request to say http://localhost:9000 where both
requests are going to the same host but different addresses, the
UriInfo object returns the base uri of the second request instead of the
first one. So, it seems the UriInfo or message object is somehow
Being shared between threads.
Following is the log that shows the problem 9 I have hightlighted the
hostname and thread numbers.
[INFO ][17:05:02,258][::][v()][t(http-9000-2)]
[
gwy.ws.jaxrs.ElaborationProcessor.handleRequest(ElaborationProcessor.jav
a:12
9) ]
---- elaboration map: {host=192.168.1.102:9000,
gateway-version=1.2.11-2,
reply=json, user-agent=curl/7.16.3 (powerpc-apple-darwin9.0)
libcurl/7.16.3
OpenSSL/0.9.7l zlib/1.2.3, Accept=*/*}
[INFO ][17:05:02,257][::][v()][t(http-9000-1)]
[
gwy.ws.jaxrs.ElaborationProcessor.handleRequest(ElaborationProcessor.jav
a:12
9) ]
---- elaboration map: {host=localhost:9000, gateway-version=1.2.11-2,
reply=json, user-agent=curl/7.16.3 (powerpc-apple-darwin9.0)
libcurl/7.16.3
OpenSSL/0.9.7l zlib/1.2.3, Accept=*/*}
[DEBUG][17:05:02,258][::][v()][t(http-9000-2)]
[
gwy.ws.jaxrs.ElaborationProcessor.handleRequest(ElaborationProcessor.jav
a:14
7) ]
---- request method: GET
[DEBUG][17:05:02,258][::][v()][t(http-9000-1)]
[
gwy.ws.jaxrs.ElaborationProcessor.handleRequest(ElaborationProcessor.jav
a:14
7) ]
---- request method: GET
[DEBUG][17:05:02,259][::][v()][t(http-9000-2)]
[ gwy.ws.jaxrs.UriInfoManager.setUi(UriInfoManager.java:51) ]
---- setUi() beging UriInfo base URI: http://localhost:9000/domain
[DEBUG][17:05:02,259][::][v()][t(http-9000-1)]
[ gwy.ws.jaxrs.UriInfoManager.setUi(UriInfoManager.java:51) ]
---- setUi() beging UriInfo base URI: http://localhost:9000/domain
Any help is much appreciated.
Please let me know if I can supply more info.
Thanks,
Sadhana