Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonTemplateLayout: java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space #2516

Closed
PassiveIncomeMachine opened this issue Apr 25, 2024 · 6 comments
Labels

Comments

@PassiveIncomeMachine
Copy link

PassiveIncomeMachine commented Apr 25, 2024

Constructor ERROR Could not create plugin of type class org.apache.logging.log4j.layout.template.json.JsonTemplateLayout for element JsonTemplateLayout: java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space

Here is what I have configured.

<Console name="CONSOLE-OUTPUT" target="SYSTEM_OUT">
    <JsonTemplateLayout eventTemplateUri="classpath:Layout.json" maxStringLength="10000000">
        <EventTemplateAdditionalField key="appName" value="AA" />
        <EventTemplateAdditionalField key="appenderName" value="OUTPUT" />
        <EventTemplateAdditionalField key="consoleLogIdentifier" value="LOG-IDENTIFIER"/>
    </JsonTemplateLayout>
    <Filters>
        <RegexFilter regex="(?s).*AvailabilityReport.*"
            useRawMsg="true" onMatch="ACCEPT" onMismatch="NEUTRAL" />
        <RegexFilter regex="(?s).*OccupancyReport.*"
            useRawMsg="true" onMatch="ACCEPT" onMismatch="DENY" />
    </Filters>
</Console>

Configuration

Version: 2.23.1

Operating system: Red Hat Enterprise Linux release 8.4 (Ootpa)

JDK: openjdk version "11.0.13" 2021-10-19 LTS

Logs

2024-04-23 12:00:26,623 Constructor ERROR Could not create plugin of type class org.apache.logging.log4j.layout.template.json.JsonTemplateLayout for element JsonTemplateLayout: java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space
@vy
Copy link
Member

vy commented Apr 25, 2024

@PassiveIncomeMachine, could you share the following information too, please?

  1. A complete stack trace (pointing to some line numbers in the org.apache.logging.log4j package, etc.)
  2. Layout.json file

For the record, maxStringLength="10000000" looks dangerous to me. Note that it doesn't limit the total JSON document length, but the maximum length of a String-typed field in the JSON document. I would try to keep it way lower.

@vy vy added waiting-for-user More information is needed from the user and removed waiting-for-maintainer labels Apr 25, 2024
@github-actions github-actions bot added the Stale label May 3, 2024
@ppkarwasz ppkarwasz removed the Stale label May 3, 2024
@apache apache deleted a comment from github-actions bot May 3, 2024
@PassiveIncomeMachine
Copy link
Author

PassiveIncomeMachine commented May 20, 2024

Thanks VY
please check my TPLayout.json file
TPLayout.json

and also attach my send message
<?xml version="1.0" encoding="utf-8" ?> <TPUpdate xmlns="www.w3.org/2001/XMLSchema"> <MatchExecuted>true</MatchExecuted> <EventTime>2023-03-29T03:16:30.000Z</EventTime> <TP> <TP_Identification>RTP29031616</TP_Identification> <TPBGTag> <TPPC>1274612422</TPPC> </TPBGTag> <Inbound_Class></Inbound_Class> <Outbound_Class></Outbound_Class> <Outbound_Destination></Outbound_Destination> <GroupName></GroupName> <TPBG_Security_Status></TPBG_Security_Status> <RequiredLevel>0</RequiredLevel> <ReachedLevel>0</ReachedLevel> <FailedLevel>0</FailedLevel> <ReachedIntensity></ReachedIntensity> <RequiredIntensity>NAL</RequiredIntensity> <Size>80</Size> <NextTP>Coding</NextTP> <FinalTP>AA90</FinalTP> <Last_TPID>521</Last_TPID> <TPPC_Status></TPPC_Status> <Tubbing_Necessity>0</Tubbing_Necessity> <Tubbed_Indicator>0</Tubbed_Indicator> <PriorityIndicator></PriorityIndicator> <PassengerStatus></PassengerStatus> <Next_TPID>4</Next_TPID> <SegregationGroupRule>RULE-1000000001-01</SegregationGroupRule> <SortationDecisionGroupRule>RULE-1000000113-01</SortationDecisionGroupRule> <SortationDecisionGroupID>932942</SortationDecisionGroupID> <NextProcessStep>Route</NextProcessStep> <SegregationGroupRulePriority>99</SegregationGroupRulePriority> <SortationDecisionGroupRulePriority>1</SortationDecisionGroupRulePriority> <ProcessException></ProcessException> <PhysicalClass></PhysicalClass> </TP> <Segment>91000</Segment> <location> <Area>10120</Area> </location> </TPUpdate>

@vy
Copy link
Member

vy commented May 21, 2024

@PassiveIncomeMachine,

  1. I am still missing a stack trace. Please send a complete stack trace.
  2. The TPLayout.json you shared contains a custom resolver: humanMessage. Can this be our smoking gun?
  3. I don't know what I am supposed to the do with the XML formatted message you shared.

Copy link

This issue is stale because it has been waiting for your feedback for more than 60 days. The Apache Logging Services community values every submitted issue, but without additional information from you, we are unable to provide a solution to your problem.
Please comment on this issue or it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jul 21, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 28, 2024
@PassiveIncomeMachine
Copy link
Author

I will do one update ASAP.

@github-actions github-actions bot added waiting-for-maintainer and removed waiting-for-user More information is needed from the user labels Aug 1, 2024
@ppkarwasz ppkarwasz reopened this Aug 1, 2024
@ppkarwasz ppkarwasz added waiting-for-user More information is needed from the user and removed waiting-for-maintainer Stale labels Aug 1, 2024
Copy link

github-actions bot commented Oct 1, 2024

This issue is stale because it has been waiting for your feedback for more than 60 days. The Apache Logging Services community values every submitted issue, but without additional information from you, we are unable to provide a solution to your problem.
Please comment on this issue or it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Oct 1, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
@ppkarwasz ppkarwasz removed the waiting-for-user More information is needed from the user label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants