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

StackOverflowError using Javac with DbSetup DataSet #1118

Open
Toilal opened this issue May 24, 2016 · 21 comments
Open

StackOverflowError using Javac with DbSetup DataSet #1118

Toilal opened this issue May 24, 2016 · 21 comments

Comments

@Toilal
Copy link

Toilal commented May 24, 2016

I use DbSetup to define dataset for tests.

When trying to compile the project test classes (mvn clean test-compile), it crash with a StackOverflowError.

Caused by: java.lang.RuntimeException: java.lang.StackOverflowError
    at com.sun.tools.javac.main.Main.compile(Main.java:553)
    at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
    at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
    ... 25 more
Caused by: java.lang.StackOverflowError
    at lombok.core.AST.fieldsOf(AST.java:219)
    at lombok.javac.JavacAST.drill(JavacAST.java:345)
    at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:339)
    at lombok.javac.JavacAST.buildTree(JavacAST.java:198)
    at lombok.javac.JavacAST.buildTree(JavacAST.java:65)
...

Increasing the JVM stack size using -Xss4m fix the issue, but it seems like a workaround to me and maybe Lombok could be enhanced to avoid this ?

Here's an example of DbSetup classes that cause crash. As you can see, there's long fluent calls to define data, it's probably the huge call hierarchy that makes JavacAST eating up the stack ...

PS: I use Java 8 on Ubuntu, same issue on Windows.

package common;

import static com.ninja_squad.dbsetup.Operations.insertInto;

import com.ninja_squad.dbsetup.operation.Operation;

public class DatasetOperationsDomaine extends DatasetOperationsEltProg {

    public static final Operation INSERT_DOMAINE = insertInto("TEST.DOMAINE")
            .columns("DOMAINE_ID", "CODE", "LIBELLE", "DOMAINE_PARENT_ID", "MILLESIME_OUVERTURE")
            .values(1, "FRA-RAC", "Français", null, "2015")
            .values(2, "FRA-LGO", "Langage oral", 1, "2015")
            .values(3, "FRA-LEC", "Lecture et compréhension de l’écrit", 1, "2015")
            .values(4, "FRA-ECR", "Écriture", 1, "2015")
            .values(5, "FRA-ETL", "Étude de la langue (grammaire, orthographe, lexique)", 1, "2015")
            .values(6, "FRA-LIT", "Culture littéraire et artistique", 1, "2015")
            .values(7, "MAT-RAC", "Mathématiques", null, "2015")
            .values(8, "MAT-NBC", "Nombres et calcul", 7, "2015")
            .values(9, "MAT-GEO", "Espace et géométrie", 7, "2015")
            .values(10, "MAT-GDM", "Grandeurs et mesures", 7, "2015")
            .values(11, "MAT-DON", "Organisation et gestion de données", 7, "2015")
            .values(12, "MAT-PRG", "Algorithmique et programmation", 7, "2015")
            .values(13, "EPS-RAC", "Éducation physique et sportive", null, "2015")
            .values(14, "EPS-PFM",
                    "Produire une performance optimale mesurable à une échéance donnée", 13, "2015")
            .values(15, "EPS-DEP", "Adapter ses déplacements a des environnements variés", 13,
                    "2015")
            .values(16, "EPS-ART",
                    "S’exprimer devant les autres par une prestation artistique et acrobatique", 13,
                    "2015")
            .values(17, "EPS-AFF",
                    "Conduire et maîtriser un affrontement collectif et interindividuel", 13,
                    "2015")
            .values(18, "LGV-RAC", "Langues vivantes", null, "2015")
            .values(19, "LGV-CPD", "Comprendre l’oral", 18, "2015")
            .values(20, "LGV-EXP", "S’exprimer oralement en continu", 18, "2015")
            .values(21, "LGV-CVS", "Prendre part à une conversation", 18, "2015")
            .values(22, "LGV-DE1",
                    "Découvrir quelques aspects culturels d’une langue vivante étrangère et régionale",
                    18, "2015")
            .values(23, "LGV-ECO", "Écouter et comprendre", 18, "2015")
            .values(24, "LGV-LIR", "Lire et comprendre", 18, "2015")
            .values(25, "LGV-PAR", "Parler en continu", 18, "2015")
            .values(26, "LGV-ECR", "Écrire", 18, "2015")
            .values(27, "LGV-DIA", "Réagir et dialoguer", 18, "2015")
            .values(28, "LGV-DE2", "Découvrir des aspects culturels de la langue", 18, "2015")
            .values(29, "QLM-RAC", "Questionner le monde", null, "2015")
            .values(30, "QLM-VMO", "Vivant, matière, objets", 29, "2015")
            .values(31, "QLM-ETP", "Espace, temps", 29, "2015")
            .values(32, "QLM-EXP", "Explorer les organisations du monde", 29, "2015")
            .values(33, "ART-RAC", "Enseignements artistiques", null, "2015")
            .values(34, "ART-PLA", "Arts plastiques", 33, "2015")
            .values(35, "ART-MUS", "Éducation musicale", 33, "2015")
            .values(36, "ART-HIS", "Histoire des arts", 33, "2015")
            .values(37, "EMC-RAC", "Enseignement moral et civique", null, "2015")
            .values(38, "EMC-SNS", "La sensibilité", 37, "2015")
            .values(39, "EMC-DRG", "Le droit et la règle", 37, "2015")
            .values(40, "EMC-JUG", "Le jugement", 37, "2015")
            .values(41, "EMC-ENG", "L’engagement", 37, "2015")
            .values(42, "STC-RAC", "Sciences et technologie", null, "2015")
            .values(43, "STC-THM", "Thèmes", 42, "2015")
            .values(44, "STC-CPT", "Compétences", 42, "2015")
            .values(45, "HIG-RAC", "Histoire et géographie", null, "2015")
            .values(46, "HIG-CPT", "Compétences", 45, "2015")
            .values(47, "HIG-TPS", "Se repérer dans le temps : construire des repères historiques",
                    45, "2015")
            .values(48, "HIG-ESP",
                    "Se repérer dans l'espace : construire des repères géographiques", 45, "2015")
            .values(49, "HIG-RSN", "Raisonner, justifier une démarche et les choix effectués", 45,
                    "2015")
            .values(50, "HIG-NUM", "S'informer dans le monde du numérique", 45, "2015")
            .values(51, "HIG-DOC", "Comprendre un document", 45, "2015")
            .values(52, "HIG-PLG", "Pratiquer différents langages en histoire et en géographie", 45,
                    "2015")
            .values(53, "HIG-MUT", "Coopérer et mutualiser", 45, "2015")
            .values(54, "HIG-ANA", "Analyser et Comprendre un document", 45, "2015")
            .values(55, "SVT-RAC", "Sciences de la vie et de la terre", null, "2015")
            .values(56, "SVT-THM", "Thèmes", 55, "2015")
            .values(57, "SVT-CPT", "Compétences", 55, "2015")
            .values(58, "PHC-RAC", "Physique-chimie", null, "2015")
            .values(59, "PHC-THM", "Thèmes", 58, "2015")
            .values(60, "PHC-CPT", "Compétences", 58, "2015")
            .values(61, "TEC-RAC", "Technologie", null, "2015")
            .values(62, "TEC-DEM", "Pratiquer des démarches scientifiques et technologiques", 61,
                    "2015")
            .values(63, "TEC-CCR", "Concevoir, créer, réaliser", 61, "2015")
            .values(64, "TEC-OUT", "S’approprier des outils et des méthodes", 61, "2015")
            .values(65, "TEC-PLG", "Pratiquer des langages", 61, "2015")
            .values(66, "TEC-NUM", "Mobiliser des outils numériques", 61, "2015")
            .values(67, "TEC-RSP", "Adopter un comportement éthique et responsable", 61, "2015")
            .values(68, "TEC-SIT", "Se situer dans l’espace et dans le temps", 61, "2015").build();

    public static final Operation INSERT_DOMAINE_NIVEAU = insertInto("TEST.DOMAINE_NIVEAU")
            .columns("DOMAINE_NIVEAU_ID", "DOMAINE_ID", "NIVEAU_ID", "ORDRE").values(1, 1, 1, 1)
            .values(2, 2, 1, 2).values(3, 3, 1, 3).values(4, 4, 1, 4).values(5, 5, 1, 5)
            .values(6, 7, 1, 6).values(7, 8, 1, 7).values(8, 9, 1, 8).values(9, 10, 1, 9)
            .values(10, 13, 1, 10).values(11, 14, 1, 11).values(12, 15, 1, 12).values(13, 16, 1, 13)
            .values(14, 17, 1, 14).values(15, 18, 1, 15).values(16, 19, 1, 16).values(17, 20, 1, 17)
            .values(18, 21, 1, 18).values(19, 22, 1, 19).values(20, 29, 1, 20).values(21, 30, 1, 21)
            .values(22, 31, 1, 22).values(23, 32, 1, 23).values(24, 33, 1, 24).values(25, 34, 1, 25)
            .values(26, 35, 1, 26).values(27, 37, 1, 27).values(28, 38, 1, 28).values(29, 39, 1, 29)
            .values(30, 40, 1, 30).values(31, 41, 1, 31).values(32, 1, 2, 1).values(33, 2, 2, 2)
            .values(34, 3, 2, 3).values(35, 4, 2, 4).values(36, 5, 2, 5).values(37, 7, 2, 6)
            .values(38, 8, 2, 7).values(39, 9, 2, 8).values(40, 10, 2, 9).values(41, 13, 2, 10)
            .values(42, 14, 2, 11).values(43, 15, 2, 12).values(44, 16, 2, 13).values(45, 17, 2, 14)
            .values(46, 18, 2, 15).values(47, 19, 2, 16).values(48, 20, 2, 17).values(49, 21, 2, 18)
            .values(50, 22, 2, 19).values(51, 29, 2, 20).values(52, 30, 2, 21).values(53, 31, 2, 22)
            .values(54, 32, 2, 23).values(55, 33, 2, 24).values(56, 34, 2, 25).values(57, 35, 2, 26)
            .values(58, 37, 2, 27).values(59, 38, 2, 28).values(60, 39, 2, 29).values(61, 40, 2, 30)
            .values(62, 41, 2, 31).values(63, 1, 3, 1).values(64, 2, 3, 2).values(65, 3, 3, 3)
            .values(66, 4, 3, 4).values(67, 5, 3, 5).values(68, 7, 3, 6).values(69, 8, 3, 7)
            .values(70, 9, 3, 8).values(71, 10, 3, 9).values(72, 13, 3, 10).values(73, 14, 3, 11)
            .values(74, 15, 3, 12).values(75, 16, 3, 13).values(76, 17, 3, 14).values(77, 18, 3, 15)
            .values(78, 19, 3, 16).values(79, 20, 3, 17).values(80, 21, 3, 18).values(81, 22, 3, 19)
            .values(82, 29, 3, 20).values(83, 30, 3, 21).values(84, 31, 3, 22).values(85, 32, 3, 23)
            .values(86, 33, 3, 24).values(87, 34, 3, 25).values(88, 35, 3, 26).values(89, 37, 3, 27)
            .values(90, 38, 3, 28).values(91, 39, 3, 29).values(92, 40, 3, 30).values(93, 41, 3, 31)
            .values(94, 1, 4, 1).values(95, 2, 4, 2).values(96, 3, 4, 3).values(97, 4, 4, 4)
            .values(98, 5, 4, 5).values(99, 7, 4, 6).values(100, 8, 4, 7).values(101, 9, 4, 8)
            .values(102, 10, 4, 9).values(103, 13, 4, 10).values(104, 14, 4, 11)
            .values(105, 15, 4, 12).values(106, 16, 4, 13).values(107, 17, 4, 14)
            .values(108, 18, 4, 15).values(109, 23, 4, 16).values(110, 24, 4, 17)
            .values(111, 25, 4, 18).values(112, 26, 4, 19).values(113, 27, 4, 20)
            .values(114, 28, 4, 21).values(115, 42, 4, 22).values(116, 43, 4, 23)
            .values(117, 44, 4, 24).values(118, 45, 4, 25).values(119, 46, 4, 26)
            .values(120, 33, 4, 27).values(121, 34, 4, 28).values(122, 35, 4, 29)
            .values(123, 36, 4, 30).values(124, 37, 4, 31).values(125, 38, 4, 32)
            .values(126, 39, 4, 33).values(127, 40, 4, 34).values(128, 41, 4, 35)
            .values(129, 1, 5, 1).values(130, 2, 5, 2).values(131, 3, 5, 3).values(132, 4, 5, 4)
            .values(133, 5, 5, 5).values(134, 7, 5, 6).values(135, 8, 5, 7).values(136, 9, 5, 8)
            .values(137, 10, 5, 9).values(138, 13, 5, 10).values(139, 14, 5, 11)
            .values(140, 15, 5, 12).values(141, 16, 5, 13).values(142, 17, 5, 14)
            .values(143, 18, 5, 15).values(144, 23, 5, 16).values(145, 24, 5, 17)
            .values(146, 25, 5, 18).values(147, 26, 5, 19).values(148, 27, 5, 20)
            .values(149, 28, 5, 21).values(150, 42, 5, 22).values(151, 43, 5, 23)
            .values(152, 44, 5, 24).values(153, 45, 5, 25).values(154, 46, 5, 26)
            .values(155, 33, 5, 27).values(156, 34, 5, 28).values(157, 35, 5, 29)
            .values(158, 36, 5, 30).values(159, 37, 5, 31).values(160, 38, 5, 32)
            .values(161, 39, 5, 33).values(162, 40, 5, 34).values(163, 41, 5, 35)
            .values(164, 1, 6, 1).values(165, 2, 6, 2).values(166, 3, 6, 3).values(167, 4, 6, 4)
            .values(168, 5, 6, 5).values(169, 6, 6, 6).values(170, 7, 6, 7).values(171, 8, 6, 8)
            .values(172, 9, 6, 9).values(173, 10, 6, 10).values(174, 13, 6, 11)
            .values(175, 14, 6, 12).values(176, 15, 6, 13).values(177, 16, 6, 14)
            .values(178, 17, 6, 15).values(179, 18, 6, 16).values(180, 23, 6, 17)
            .values(181, 24, 6, 18).values(182, 25, 6, 19).values(183, 26, 6, 20)
            .values(184, 27, 6, 21).values(185, 28, 6, 22).values(186, 45, 6, 23)
            .values(187, 47, 6, 24).values(188, 48, 6, 25).values(189, 49, 6, 26)
            .values(190, 50, 6, 27).values(191, 51, 6, 28).values(192, 52, 6, 29)
            .values(193, 53, 6, 30).values(194, 33, 6, 31).values(195, 34, 6, 32)
            .values(196, 35, 6, 33).values(197, 36, 6, 34).values(198, 37, 6, 35)
            .values(199, 38, 6, 36).values(200, 39, 6, 37).values(201, 40, 6, 38)
            .values(202, 41, 6, 39).values(203, 55, 6, 40).values(204, 56, 6, 41)
            .values(205, 57, 6, 42).values(206, 58, 6, 43).values(207, 59, 6, 44)
            .values(208, 60, 6, 45).values(209, 1, 7, 1).values(210, 2, 7, 2).values(211, 4, 7, 3)
            .values(212, 3, 7, 4).values(213, 5, 7, 5).values(214, 6, 7, 6).values(215, 7, 7, 7)
            .values(216, 8, 7, 8).values(217, 11, 7, 9).values(218, 9, 7, 10).values(219, 10, 7, 11)
            .values(220, 12, 7, 12).values(221, 13, 7, 13).values(222, 14, 7, 14)
            .values(223, 15, 7, 15).values(224, 16, 7, 16).values(225, 17, 7, 17)
            .values(226, 18, 7, 18).values(227, 23, 7, 19).values(228, 24, 7, 20)
            .values(229, 25, 7, 21).values(230, 26, 7, 22).values(231, 27, 7, 23)
            .values(232, 28, 7, 24).values(233, 45, 7, 25).values(234, 47, 7, 26)
            .values(235, 48, 7, 27).values(236, 49, 7, 28).values(237, 50, 7, 29)
            .values(238, 54, 7, 30).values(239, 52, 7, 31).values(240, 53, 7, 32)
            .values(241, 33, 7, 33).values(242, 34, 7, 34).values(243, 35, 7, 35)
            .values(244, 36, 7, 36).values(245, 37, 7, 37).values(246, 38, 7, 38)
            .values(247, 39, 7, 39).values(248, 40, 7, 40).values(249, 41, 7, 41)
            .values(250, 61, 7, 42).values(251, 62, 7, 43).values(252, 63, 7, 44)
            .values(253, 64, 7, 45).values(254, 65, 7, 46).values(255, 66, 7, 47)
            .values(256, 67, 7, 48).values(257, 68, 7, 49).values(258, 55, 7, 50)
            .values(259, 56, 7, 51).values(260, 57, 7, 52).values(261, 58, 7, 53)
            .values(262, 59, 7, 54).values(263, 60, 7, 55).values(264, 1, 8, 1).values(265, 2, 8, 2)
            .values(266, 4, 8, 3).values(267, 3, 8, 4).values(268, 5, 8, 5).values(269, 6, 8, 6)
            .values(270, 7, 8, 7).values(271, 8, 8, 8).values(272, 11, 8, 9).values(273, 9, 8, 10)
            .values(274, 10, 8, 11).values(275, 12, 8, 12).values(276, 13, 8, 13)
            .values(277, 14, 8, 14).values(278, 15, 8, 15).values(279, 16, 8, 16)
            .values(280, 17, 8, 17).values(281, 18, 8, 18).values(282, 23, 8, 19)
            .values(283, 24, 8, 20).values(284, 25, 8, 21).values(285, 26, 8, 22)
            .values(286, 27, 8, 23).values(287, 28, 8, 24).values(288, 45, 8, 25)
            .values(289, 47, 8, 26).values(290, 48, 8, 27).values(291, 49, 8, 28)
            .values(292, 50, 8, 29).values(293, 54, 8, 30).values(294, 52, 8, 31)
            .values(295, 53, 8, 32).values(296, 33, 8, 33).values(297, 34, 8, 34)
            .values(298, 35, 8, 35).values(299, 36, 8, 36).values(300, 37, 8, 37)
            .values(301, 38, 8, 38).values(302, 39, 8, 39).values(303, 40, 8, 40)
            .values(304, 41, 8, 41).values(305, 61, 8, 42).values(306, 62, 8, 43)
            .values(307, 63, 8, 44).values(308, 64, 8, 45).values(309, 65, 8, 46)
            .values(310, 66, 8, 47).values(311, 67, 8, 48).values(312, 68, 8, 49)
            .values(313, 55, 8, 50).values(314, 56, 8, 51).values(315, 57, 8, 52)
            .values(316, 58, 8, 53).values(317, 59, 8, 54).values(318, 60, 8, 55)
            .values(319, 1, 9, 1).values(320, 2, 9, 2).values(321, 4, 9, 3).values(322, 3, 9, 4)
            .values(323, 5, 9, 5).values(324, 6, 9, 6).values(325, 7, 9, 7).values(326, 8, 9, 8)
            .values(327, 11, 9, 9).values(328, 9, 9, 10).values(329, 10, 9, 11)
            .values(330, 12, 9, 12).values(331, 13, 9, 13).values(332, 14, 9, 14)
            .values(333, 15, 9, 15).values(334, 16, 9, 16).values(335, 17, 9, 17)
            .values(336, 18, 9, 18).values(337, 23, 9, 19).values(338, 24, 9, 20)
            .values(339, 25, 9, 21).values(340, 26, 9, 22).values(341, 27, 9, 23)
            .values(342, 28, 9, 24).values(343, 45, 9, 25).values(344, 47, 9, 26)
            .values(345, 48, 9, 27).values(346, 49, 9, 28).values(347, 50, 9, 29)
            .values(348, 54, 9, 30).values(349, 52, 9, 31).values(350, 53, 9, 32)
            .values(351, 33, 9, 33).values(352, 34, 9, 34).values(353, 35, 9, 35)
            .values(354, 36, 9, 36).values(355, 37, 9, 37).values(356, 38, 9, 38)
            .values(357, 39, 9, 39).values(358, 40, 9, 40).values(359, 41, 9, 41)
            .values(360, 61, 9, 42).values(361, 62, 9, 43).values(362, 63, 9, 44)
            .values(363, 64, 9, 45).values(364, 65, 9, 46).values(365, 66, 9, 47)
            .values(366, 67, 9, 48).values(367, 68, 9, 49).values(368, 55, 9, 50)
            .values(369, 56, 9, 51).values(370, 57, 9, 52).values(371, 58, 9, 53)
            .values(372, 59, 9, 54).values(373, 60, 9, 55).build();
}
@rspilker
Copy link
Collaborator

Externalizing the stack would be the proper solution.

@janisz
Copy link

janisz commented Jun 15, 2022

I have the same problem with classes generated from latest openapi generator OpenAPITools/openapi-generator#12595

@jguidoux
Copy link

Hello. I don’t know if it is the good place or not.
I am trying to build in intellij a really large maven project containing around 300 maven modules and around 3 million java lines of code.
When building it, I have a StackOverflow error.
I post in the intellij forum my issue https://intellij-support.jetbrains.com/hc/en-us/community/posts/6608906517394-Build-large-maven-project-
After some research, Apparently it is coming from Lombok .
We have this stacktrace :
2022-07-14 00:42:47,242 [ 907730] INFO - #o.j.j.i.j.JavaBuilder - java.lang.StackOverflowError java.lang.RuntimeException: java.lang.StackOverflowError at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:168) at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100) at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94) at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:238) at org.jetbrains.jps.incremental.java.JavaBuilder.lambda$compileJava$2(JavaBuilder.java:519) at org.jetbrains.jps.incremental.java.JavaBuilder.invokeJavac(JavaBuilder.java:565) at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:517) at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:360) at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:285) at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:239) at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1519) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1149) at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1299) at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1114) at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:885) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:467) at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:197) at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:150) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:348) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:175) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:218) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.lang.StackOverflowError at java.base/java.lang.reflect.Field.get(Field.java:425) at lombok.core.AST.buildWithField0(AST.java:391) at lombok.core.AST.buildWithField(AST.java:292) at lombok.javac.JavacAST.drill(JavacAST.java:506) at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:476) at lombok.javac.JavacAST.buildTree(JavacAST.java:285) at lombok.javac.JavacAST.buildTree(JavacAST.java:1) at lombok.core.AST.buildWithField0(AST.java:394) at lombok.core.AST.buildWithField(AST.java:292) at lombok.javac.JavacAST.drill(JavacAST.java:506) at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:476) at lombok.javac.JavacAST.buildTree(JavacAST.java:285) at lombok.javac.JavacAST.buildTree(JavacAST.java:1) at lombok.core.AST.buildWithField0(AST.java:394) at lombok.core.AST.buildWithField(AST.java:292) at lombok.javac.JavacAST.drill(JavacAST.java:506) at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:476) at lombok.javac.JavacAST.buildTree(JavacAST.java:285) at lombok.javac.JavacAST.buildTree(JavacAST.java:1) at lombok.core.AST.buildWithField0(AST.java:394) at lombok.core.AST.buildWithField(AST.java:292) at lombok.javac.JavacAST.drill(JavacAST.java:506)

Do you have any idea how to resolve it ? Or Is there some work in Lombok to resolve this issue ?
As said in the Intellij forum. With pure maven, I can build the project with no Issue.

@jguidoux
Copy link

jguidoux commented Aug 5, 2022

How is going this issue ? Do you have any progress ?

@janisz
Copy link

janisz commented Aug 8, 2022

Have you tried increasing stack size (-Xss) in IDEA?
If it's building on maven and eclipse this means there is a difference between how lombok is called.
What I can suggest is to try my patch with maven but with limited stack size to reproduce this error and find a place where it happens and fix that place. Probably you have a very long statement in you code and this cause overflow.

@jguidoux
Copy link

jguidoux commented Aug 8, 2022

I did several tests by increasing -Xss until -Xss12m. No changes.
Which patch are you talking about ?
There is probably a difference with intellij and the other tool. But which one, and by the way, I don’t think that we can change how intellij call lombok.

@janisz
Copy link

janisz commented Aug 8, 2022

That's why I recommended replicating issue with maven where you can control java opts and lombok version.
Patch I'm referring too #3213

@SilenceSu
Copy link

How is going this issue ? Do you have any progress ?
I'm also waiting for a response, idea 2023.1

@mikebm
Copy link

mikebm commented Jul 3, 2023

I have the same problem with classes generated from latest openapi generator OpenAPITools/openapi-generator#12595

I have the same issue. Did you ever find a solution? Works fine building on OSX but fails on linux in github.

Update: This seemed to get it working-
MAVEN_OPTS: -Xss1024k

@SilenceSu
Copy link

I have the same problem with classes generated from latest openapi generator OpenAPITools/openapi-generator#12595

I have the same issue. Did you ever find a solution? Works fine building on OSX but fails on linux in github.

Update: This seemed to get it working- MAVEN_OPTS: -Xss1024k

The main reason for this issue is the file being too large, which causes a stack out of memory error during parsing. Until the bug is fixed, the core solutions are:

1、 split the excessively large file parsed using lombok.
2、increase Xss

@mikebm
Copy link

mikebm commented Jul 25, 2023

Is there by chance a way to exclude target/generated-sources from being scanned by lombok? I use the maven-compiler-plugin with annotationProcessorPaths to run lombok. In my scenerio, the stack overflow error is when lombok parses the large files generated by openapi-generator-maven-plugin. These don't use lombok so i'd like to exclude them to prevent having to set the MVN xss size everywhere. Thanks.

@janisz
Copy link

janisz commented Jul 25, 2023

@mikebm I have same problem and finally fixed the generator:

@mikebm
Copy link

mikebm commented Jul 25, 2023

@janisz I am already on 6.0.0 of the generator, so the fix didn't appear to solve it.
EDIT: Oh maybe your fix isn't in 6.0...

@janisz
Copy link

janisz commented Jul 25, 2023

It's in 6.0.1 https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.0.1 but it was only for okhttp if you sue different backend then it might not work.

@mikebm
Copy link

mikebm commented Jul 25, 2023

It's in 6.0.1 https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.0.1 but it was only for okhttp if you sue different backend then it might not work.

Yeah. Tried 6.6.0 and it didn't work for me. Thanks though. I think my question still stands. I don't need lombok processing my target folder, so if i can figure out how to do that, it would resolve my issue.

@janisz
Copy link

janisz commented Jul 25, 2023

Agree, this will save some time as there is probably no point in scanning generated code.

@shalakhansidmul
Copy link

shalakhansidmul commented Aug 30, 2023

Hello,
I think I am facing the issue mentioned in this post.

  [javac] An annotation processor threw an uncaught exception.
    [javac] Consult the following stack trace for details.
    [javac] java.lang.StackOverflowError
    [javac]     at lombok.javac.JavacAST.drill(JavacAST.java:506)
    [javac]     at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:476)
    [javac]     at lombok.javac.JavacAST.buildTree(JavacAST.java:285)
    [javac]     at lombok.javac.JavacAST.buildTree(JavacAST.java:1)
    [javac]     at lombok.core.AST.buildWithField0(AST.java:394)
    [javac]     at lombok.core.AST.buildWithField(AST.java:292)

The error does not specify which file it is failing at.
I am trying to upgrade to JDK11 from JDK 8 and that requires upgrading to Lombok 1.18.x as Lombok 1.16.x does not work with JDK11.
I have only 1 file in the code that is 638 lines long. That file does not have any Lombok annotations.
Any suggestion on how to work around this issue ?

@janisz
Copy link

janisz commented Aug 31, 2023

You can use #3213 to narrow down the error.
If you have a long statements (a lot of dots: e.g. builder with lot of fileds). Split it into multiple smaller statements.

@OnielN14
Copy link

OnielN14 commented Nov 6, 2023

For me, by using x64 version of the JDK resolve the StackOverflowError error. I'm using JDK 11.

@Captain-P-Goldfish
Copy link

We could verfiy this too today. Breaking the long chained call down fixed the problem. But it took some time.
OS: Windows Pro x64
JDK: amazonCorretto-21

@andresmonc
Copy link

Seeing the same issue. We're working with netflix DGS Framework and query building requires a very large number of chained operations.

Caused by: java.lang.StackOverflowError
        at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:384)
        at lombok.javac.JavacAST.buildTree(JavacAST.java:196)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants