Petals ESB Container

Implementation of MessageExchange does not respect owner contract

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 4.2.4
  • Fix Version/s: 5.0.0
  • Component/s: Micro-kernel
  • Security Level: Public
  • Description:
    Hide

    Operations on MessageExchange should throw IllegalStateException when a component that does not own the exchange in the current state calls them.

    The bug is caused by the fact that MessageExchangeWrapper, which is responsible of doing that check, is shared between consumer and provider and thus doesn't reflect correctly the role of the owner of a reference to the message as it should.
    (The code was actually documented as doing that, even though it wasn't, until commit r37114 where I corrected the documentation without realising the code should be fixed instead .

    A solution is to actually have 2 instances of the MessageExchangeWrapper, one for each actor of the exchange, so that their observerRole field actually reflect the reality.

    The problem is that many code in the kernel relies on the fact that the object is shared between the consumer and the provider.

    Show
    Operations on MessageExchange should throw IllegalStateException when a component that does not own the exchange in the current state calls them. The bug is caused by the fact that MessageExchangeWrapper, which is responsible of doing that check, is shared between consumer and provider and thus doesn't reflect correctly the role of the owner of a reference to the message as it should. (The code was actually documented as doing that, even though it wasn't, until commit r37114 where I corrected the documentation without realising the code should be fixed instead . A solution is to actually have 2 instances of the MessageExchangeWrapper, one for each actor of the exchange, so that their observerRole field actually reflect the reality. The problem is that many code in the kernel relies on the fact that the object is shared between the consumer and the provider.
  • Environment:
    -

Issue Links

Activity

Victor NOËL made changes - Thu, 23 Apr 2015 - 10:45:52 +0200
Field Original Value New Value
Assignee Christophe DENEUX [ cdeneux ] Victor NOËL [ vnoel ]
Victor NOËL made changes - Thu, 23 Apr 2015 - 11:35:25 +0200
Priority Blocker [ 1 ]
Victor NOËL made changes - Tue, 21 Jul 2015 - 17:50:19 +0200
Priority Blocker [ 1 ] Major [ 3 ]
Hide
Victor NOËL added a comment - Wed, 22 Jul 2015 - 16:57:26 +0200

Some citation from the specification to clarify the meaning of ownership (p. 45):

MessageExchange instances are owned by either the initiator, servicer, or NMR. Creating or accepting a message exchange instance confers ownership on the creating (or accepting) component. Upon calling send() for a particular ME instance, the component surrenders ownership of the ME instance immediately. sendSync() causes ownership to be surrendered during the course of the call; when the call ends (returning true) the component resumes ownership of the ME instance. Ownership of an ME instance gives the owner the right to read from and write to the instance. When a component (or the NMR) doesn't have ownership of an ME instance, it MUST NOT read from or write to the instance, except for reading the message exchange status, which can be queried regardless of ownership. If a component that is not the current owner of the instance does attempt to call any method (other than getStatus()) on the instance an appropriate java.lang.IllegalStateException MUST be thrown.

Show
Victor NOËL added a comment - Wed, 22 Jul 2015 - 16:57:26 +0200 Some citation from the specification to clarify the meaning of ownership (p. 45):
MessageExchange instances are owned by either the initiator, servicer, or NMR. Creating or accepting a message exchange instance confers ownership on the creating (or accepting) component. Upon calling send() for a particular ME instance, the component surrenders ownership of the ME instance immediately. sendSync() causes ownership to be surrendered during the course of the call; when the call ends (returning true) the component resumes ownership of the ME instance. Ownership of an ME instance gives the owner the right to read from and write to the instance. When a component (or the NMR) doesn't have ownership of an ME instance, it MUST NOT read from or write to the instance, except for reading the message exchange status, which can be queried regardless of ownership. If a component that is not the current owner of the instance does attempt to call any method (other than getStatus()) on the instance an appropriate java.lang.IllegalStateException MUST be thrown.
Hide
Victor NOËL added a comment - Mon, 27 Jul 2015 - 15:58:52 +0200

This is almost fixed, but there is still problems with the CDK

Show
Victor NOËL added a comment - Mon, 27 Jul 2015 - 15:58:52 +0200 This is almost fixed, but there is still problems with the CDK
Hide
Victor NOËL added a comment - Mon, 27 Jul 2015 - 16:01:04 +0200

Apparently, the problem is that once DeliveryChannel.send has been called, we can't access anymore anything from the exchange.

Show
Victor NOËL added a comment - Mon, 27 Jul 2015 - 16:01:04 +0200 Apparently, the problem is that once DeliveryChannel.send has been called, we can't access anymore anything from the exchange.
Hide
Victor NOËL added a comment - Mon, 27 Jul 2015 - 16:02:37 +0200

In a way, a solution to this problem could take PETALSCDK-14 into account.

Show
Victor NOËL added a comment - Mon, 27 Jul 2015 - 16:02:37 +0200 In a way, a solution to this problem could take PETALSCDK-14 into account.
Victor NOËL made changes - Mon, 27 Jul 2015 - 16:05:09 +0200
Link This issue blocks PETALSCDK-140 [ PETALSCDK-140 ]
Victor NOËL made changes - Mon, 27 Jul 2015 - 16:05:28 +0200
Status New [ 10000 ] Open [ 10002 ]
Victor NOËL made changes - Mon, 27 Jul 2015 - 16:05:31 +0200
Status Open [ 10002 ] In Progress [ 10003 ]
Hide
Victor NOËL added a comment - Mon, 27 Jul 2015 - 16:05:56 +0200

Resolved, now we just need to fix PETALSCDK-140.

Show
Victor NOËL added a comment - Mon, 27 Jul 2015 - 16:05:56 +0200 Resolved, now we just need to fix PETALSCDK-140.
Victor NOËL made changes - Mon, 27 Jul 2015 - 16:05:56 +0200
Status In Progress [ 10003 ] Resolved [ 10004 ]
Resolution Fixed [ 1 ]
Victor NOËL made changes - Mon, 27 Jul 2015 - 16:06:09 +0200
Fix Version/s 5.0.0 [ 10413 ]
Hide
Victor NOËL added a comment - Wed, 29 Jul 2015 - 10:54:32 +0200

FYI, the petals-mail-storage helper component for the mail integration tests was storing Exchange, and after sending them back, it lost ownership: later on, when accessing them to get their in content, exceptions were thrown… it was easy to fix, but we should be careful about that kind of things!

Show
Victor NOËL added a comment - Wed, 29 Jul 2015 - 10:54:32 +0200 FYI, the petals-mail-storage helper component for the mail integration tests was storing Exchange, and after sending them back, it lost ownership: later on, when accessing them to get their in content, exceptions were thrown… it was easy to fix, but we should be careful about that kind of things!
Transition Status Change Time Execution Times Last Executer Last Execution Date
New New Open Open
95d 5h 19m
1
Victor NOËL
Mon, 27 Jul 2015 - 16:05:28 +0200
Open Open In Progress In Progress
3s
1
Victor NOËL
Mon, 27 Jul 2015 - 16:05:31 +0200
In Progress In Progress Resolved Resolved
25s
1
Victor NOËL
Mon, 27 Jul 2015 - 16:05:56 +0200



People

Dates

  • Created:
    Thu, 23 Apr 2015 - 10:45:44 +0200
    Updated:
    Wed, 29 Jul 2015 - 10:54:33 +0200
    Resolved:
    Mon, 27 Jul 2015 - 16:05:56 +0200