[
https://issues.apache.org/jira/browse/CXF-2741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12851476#action_12851476
]
Jeffrey Poore commented on CXF-2741:
------------------------------------
Yeah, it's really kind of a strange spot to be stuck on - doesn't make any
sense for a deadlock situation. We did notice that there is a call to clear the
packageContexts that is un-synchronized, but I doubt that would cause a hang...
{code}
static void clearContexts() {
classContexts.clear();
packageContexts.clear();
}
{code}
I'll give a try on using the other object lock and see if that helps. One of my
co-workers here had the same idea of using the synchronized weak map. My
question would be, does it matter if two calls end up with different context
objects? (i.e., you make the map synchronized so that you no longer need to
synchronize the block, but now you could possibly have two threads successively
create contexts as they both get null when they check to see if it exists, and
then they both add a new context with that key)
> JAXB hang on JBoss 5.1.0
> ------------------------
>
> Key: CXF-2741
> URL: https://issues.apache.org/jira/browse/CXF-2741
> Project: CXF
> Issue Type: Bug
> Components: JAXB Databinding
> Affects Versions: 2.2.6
> Environment: JBoss 5.1.0.GA, Spring 2.5.6, javax.ws.rs.jsr311-api 1.1
> Reporter: Jeffrey Poore
>
> We have been using CXF RESTFul services for a long time on jboss-4.2.3 with
> no issues. When we switched to JBoss 5.1.0.GA, things worked fine at first,
> but we noticed that after a short period of uptime, requests began to hang
> and time out. Debugging this issue, we tracked it to the synchronized block
> in AbstractJAXBProvider.java:
> {code}
> JAXBElementProvider(AbstractJAXBProvider).getPackageContext(Class<?>) line:
> 377
> JAXBElementProvider(AbstractJAXBProvider).getJAXBContext(Class<?>, Type)
> line: 354
> JAXBElementProvider(AbstractJAXBProvider).createMarshaller(Object, Class<?>,
> Type, String) line: 453
> JAXBElementProvider.marshal(Object, Class<?>, Type, String, OutputStream,
> MediaType) line: 296
> JAXBElementProvider.writeTo(Object, Class<?>, Type, Annotation[], MediaType,
> MultivaluedMap<String,Object>, OutputStream) line: 219
> JAXRSOutInterceptor.serializeMessage(Message, Response,
> OperationResourceInfo, boolean) line: 241
> JAXRSOutInterceptor.processResponse(Message) line: 138
> JAXRSOutInterceptor.handleMessage(Message) line: 77
> PhaseInterceptorChain.doIntercept(Message) line: 243
> OutgoingChainInterceptor.handleMessage(Message) line: 76
> PhaseInterceptorChain.doIntercept(Message) line: 243
> ChainInitiationObserver.onMessage(Message) line: 109
> ServletDestination.invoke(ServletConfig, ServletContext, HttpServletRequest,
> HttpServletResponse) line: 98
> ServletController.invokeDestination(HttpServletRequest, HttpServletResponse,
> ServletDestination) line: 406
> ServletController.invoke(HttpServletRequest, HttpServletResponse) line: 139
> CXFServlet(AbstractCXFServlet).invoke(HttpServletRequest,
> HttpServletResponse) line: 142
> CXFServlet(AbstractHTTPServlet).handleRequest(HttpServletRequest,
> HttpServletResponse) line: 179
> CXFServlet(AbstractHTTPServlet).doGet(HttpServletRequest,
> HttpServletResponse) line: 108
> CXFServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse)
> line: 617
> CXFServlet(AbstractHTTPServlet).service(ServletRequest, ServletResponse)
> line: 159
> ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
> line: 290
> ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
> ReplyHeaderFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
> line: 96
> ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
> line: 235
> ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
> StandardWrapperValve.invoke(Request, Response) line: 235
> StandardContextValve.invoke(Request, Response) line: 191
> SecurityAssociationValve.invoke(Request, Response) line: 190
> JaccContextValve.invoke(Request, Response) line: 92
> SecurityContextEstablishmentValve.process(Request, Response, HttpEvent) line:
> 126
> SecurityContextEstablishmentValve.invoke(Request, Response) line: 70
> StandardHostValve.invoke(Request, Response) line: 127
> ErrorReportValve.invoke(Request, Response) line: 102
> CachedConnectionValve.invoke(Request, Response) line: 158
> StandardEngineValve.invoke(Request, Response) line: 109
> CoyoteAdapter.service(Request, Response) line: 330
> Http11Processor.process(Socket) line: 829
> Http11Protocol$Http11ConnectionHandler.process(Socket) line: 598
> JIoEndpoint$Worker.run() line: 447
> Thread.run() line: 619
> {code}
> Specifically, this method:
> {code}
> public JAXBContext getPackageContext(Class<?> type) {
> if (type == null || type == JAXBElement.class) {
> return null;
> }
> synchronized (packageContexts) {
> String packageName = PackageUtils.getPackageName(type);
> JAXBContext context = packageContexts.get(packageName);
> if (context == null) {
> try {
> context = JAXBContext.newInstance(packageName,
> type.getClassLoader(), cProperties);
> packageContexts.put(packageName, context);
> } catch (JAXBException ex) {
> LOG.fine("Error creating a JAXBContext using
> ObjectFactory : "
> + ex.getMessage());
> return null;
> }
> }
> return context;
> }
> }
> {code}
> It appears that something is holding on to the synchronized lock on
> packageContexts and thus calls just block. Any help on this would be
> appreciated.
> We are just trying to call a simple CXF service that uses JSR-311 annotated
> methods and uses JAXB as the data binding. The class and method being called
> look like this:
> {code}
> @Path("/LDAP/")
> public class LdapServicesImpl implements LdapServices {
> @GET
> @Path("/lookup/")
> @Produces("text/xml")
> @Override
> public SearchResult lookupUser(@Context UriInfo ui) {
> String userid = ui.getQueryParameters().getFirst("uid");
> SearchResult result = getLDAPInfo(userid);
> ...
> return result;
> }
> {code}
> SearchResult is our JAXB annotated class:
> {code}
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "SearchResult", namespace = "urn:ldap", propOrder = {
> "ldapUsers",
> "error"
> })
> @XmlRootElement(name = "searchResult", namespace = "urn:ldap")
> public class SearchResult
> implements Serializable
> {
> private final static long serialVersionUID = 987654321L;
> @XmlElement(namespace = "urn:ldap")
> protected LdapUsers ldapUsers;
> @XmlElement(namespace = "urn:ldap")
> protected String error;
> ... getters and setters ...
> }
> LdapUsers:
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "LdapUsers", namespace = "urn:ldap", propOrder = {
> "ldapUsers"
> })
> public class LdapUsers
> implements Serializable
> {
> private final static long serialVersionUID = 987654321L;
> @XmlElement(name = "ldapUser", namespace = "urn:ldap")
> protected List<LdapUser> ldapUsers;
> ... getters and setters ...
> }
> LdapUser:
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "LdapUser", namespace = "urn:ldap", propOrder = {
> "id",
> "fullName",
> "firstName",
> "middleName",
> "lastName",
> "address",
> "city",
> "state",
> "zip",
> "entityCode",
> "telephone",
> "title",
> "dn",
> "mail",
> "emsrowid",
> "community",
> "objectClasses",
> "groups"
> })
> public class LdapUser
> implements Serializable
> {
> private final static long serialVersionUID = 987654321L;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String id;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String fullName;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String firstName;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String middleName;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String lastName;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String address;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String city;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String state;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String zip;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String entityCode;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String telephone;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String title;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String dn;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String mail;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String emsrowid;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected String community;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected ObjectClasses objectClasses;
> @XmlElement(namespace = "urn:ldap", required = true)
> protected Groups groups;
> ... getters and setters ...
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.