james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <server-...@james.apache.org>
Subject [jira] [Commented] (JAMES-2295) JMS mailqueue deadlock when a single thread issue several consume
Date Wed, 18 Jul 2018 12:44:00 GMT

    [ https://issues.apache.org/jira/browse/JAMES-2295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16547772#comment-16547772
] 

ASF GitHub Bot commented on JAMES-2295:
---------------------------------------

Github user mbaechler commented on a diff in the pull request:

    https://github.com/apache/james-project/pull/127#discussion_r203362231
  
    --- Diff: server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/ConsumerOptions.java
---
    @@ -0,0 +1,42 @@
    +/****************************************************************
    + * Licensed to the Apache Software Foundation (ASF) under one   *
    + * or more contributor license agreements.  See the NOTICE file *
    + * distributed with this work for additional information        *
    + * regarding copyright ownership.  The ASF licenses this file   *
    + * to you under the Apache License, Version 2.0 (the            *
    + * "License"); you may not use this file except in compliance   *
    + * with the License.  You may obtain a copy of the License at   *
    + *                                                              *
    + *   http://www.apache.org/licenses/LICENSE-2.0                 *
    + *                                                              *
    + * Unless required by applicable law or agreed to in writing,   *
    + * software distributed under the License is distributed on an  *
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
    + * KIND, either express or implied.  See the License for the    *
    + * specific language governing permissions and limitations      *
    + * under the License.                                           *
    + ****************************************************************/
    +
    +package org.apache.james.queue.jms;
    +
    +import org.apache.james.queue.api.MailQueue;
    +
    +/**
    + * Provides additional options when creating consumers.
    + */
    +public interface ConsumerOptions {
    +    /**
    +     * The empty consumer options.
    +     */
    +    static ConsumerOptions empty() {
    +        return queueName -> queueName;
    +    }
    +
    +    /**
    +     * The queue name with options for performing {@link MailQueue#deQueue()} operation.
The implementation may
    +     * return {@code queueName} itself if it does not support any options.
    +     *
    +     * @return The queue name maybe with additional options.
    +     */
    +    String applyForDequeue(String queueName);
    --- End diff --
    
    maybe you already discussed that with @chibenwa but this API makes the assumption that
the queue name is actually an url where you can encode options through queryparams.
    I should clearly hide that fact because it's more than likely no useful for some kinds
of MailQueue.
    What about not putting this method only in implementations that make sense ?


> JMS mailqueue deadlock when a single thread issue several consume
> -----------------------------------------------------------------
>
>                 Key: JAMES-2295
>                 URL: https://issues.apache.org/jira/browse/JAMES-2295
>             Project: James Server
>          Issue Type: Bug
>          Components: Queue
>    Affects Versions: 3.0.0, master, 3.0.1
>            Reporter: Tellier Benoit
>            Priority: Major
>              Labels: bug
>
> This will lead to a dead lock:
> {code:java}
>         MailQueue.MailQueueItem mailQueueItem1 = getMailQueue().deQueue();
>         MailQueue.MailQueueItem mailQueueItem2 = getMailQueue().deQueue();
>         mailQueueItem1.done(true);
>         mailQueueItem2.done(true);
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message