Petals ESB Container

PetalsExecutionContext eats too much resources

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 5.0.1
  • Fix Version/s: 5.0.2
  • Component/s: None
  • Security Level: Public
  • Description:
    Hide

    ExecutionContext is used in PetalsExecutionContext, the main entry point to store flow-related information for logs.

    It is a MDC-like implementation using Properties objects.

    The problem with it is that it relies on a recursive Properties objects: every time a thread is created, a new Properties object is created (this is ok) using the previous thread as a parent (this is not ok).

    When used in Thread pools, often threads of the pool are responsible of creating new threads, and thus after a long time, we can find ourselves with a very long chain of inheriting Properties object, and after a very very long time, this can result in StackOverflowError when trying to resolve properties in them.

    Hence, we should switch from the use of ExecutionContext to a better MDC implementation, such as the one provided by default by SLF4J, since it is a future plan to switch to SLF4J (PETALSDISTRIB-135).

    Show
    ExecutionContext is used in PetalsExecutionContext, the main entry point to store flow-related information for logs. It is a MDC-like implementation using Properties objects. The problem with it is that it relies on a recursive Properties objects: every time a thread is created, a new Properties object is created (this is ok) using the previous thread as a parent (this is not ok). When used in Thread pools, often threads of the pool are responsible of creating new threads, and thus after a long time, we can find ourselves with a very long chain of inheriting Properties object, and after a very very long time, this can result in StackOverflowError when trying to resolve properties in them. Hence, we should switch from the use of ExecutionContext to a better MDC implementation, such as the one provided by default by SLF4J, since it is a future plan to switch to SLF4J (PETALSDISTRIB-135).
  • Environment:
    -

Issue Links

Activity

Victor NOËL made changes - Tue, 31 May 2016 - 13:15:07 +0200
Field Original Value New Value
Status New [ 10000 ] Open [ 10002 ]
Priority Major [ 3 ]
Assignee Christophe DENEUX [ cdeneux ] Victor NOËL [ vnoel ]
Victor NOËL made changes - Tue, 31 May 2016 - 13:15:10 +0200
Status Open [ 10002 ] In Progress [ 10003 ]
Hide
Victor NOËL added a comment - Tue, 31 May 2016 - 13:17:32 +0200

Solution is thus to to include slf4j-jdk14 in the system classloader: it is an implementation for slf4j that redirects all slf4j logs to JUL and that provides a basic but mature MDC implementation.

Note that we only need the MDC implementation for this issue, but since there is potentially dependencies in the kernel and in the components that relies on slf4j, slf4j-jdk14 will be already present in the system classloader and this will remove the need to include it in each components or the kernel (see PETALSDISTRIB-256 for more about that).

Show
Victor NOËL added a comment - Tue, 31 May 2016 - 13:17:32 +0200 Solution is thus to to include slf4j-jdk14 in the system classloader: it is an implementation for slf4j that redirects all slf4j logs to JUL and that provides a basic but mature MDC implementation. Note that we only need the MDC implementation for this issue, but since there is potentially dependencies in the kernel and in the components that relies on slf4j, slf4j-jdk14 will be already present in the system classloader and this will remove the need to include it in each components or the kernel (see PETALSDISTRIB-256 for more about that).
Victor NOËL made changes - Tue, 31 May 2016 - 13:17:48 +0200
Link This issue depends on PETALSDISTRIB-256 [ PETALSDISTRIB-256 ]
Victor NOËL made changes - Tue, 31 May 2016 - 13:18:24 +0200
Link This issue blocks PETALSDISTRIB-135 [ PETALSDISTRIB-135 ]
Victor NOËL made changes - Tue, 31 May 2016 - 13:19:22 +0200
Fix Version/s 5.0.2 [ 10661 ]
Christophe DENEUX made changes - Tue, 31 May 2016 - 16:54:19 +0200
Link This issue depends on PETALSCDK-173 [ PETALSCDK-173 ]
Victor NOËL made changes - Wed, 1 Jun 2016 - 11:21:08 +0200
Status In Progress [ 10003 ] Resolved [ 10004 ]
Resolution Fixed [ 1 ]
Transition Status Change Time Execution Times Last Executer Last Execution Date
New New Open Open
58s
1
Victor NOËL
Tue, 31 May 2016 - 13:15:07 +0200
Open Open In Progress In Progress
3s
1
Victor NOËL
Tue, 31 May 2016 - 13:15:10 +0200
In Progress In Progress Resolved Resolved
22h 5m
1
Victor NOËL
Wed, 1 Jun 2016 - 11:21:08 +0200



People

Dates

  • Created:
    Tue, 31 May 2016 - 13:14:09 +0200
    Updated:
    Wed, 1 Jun 2016 - 11:21:08 +0200
    Resolved:
    Wed, 1 Jun 2016 - 11:21:08 +0200