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

Liquibase raise java.lang.StackOverflowError error when the changeLog command is being executed against large schema ( Oracle ) #3226

Open
TearDownTheWallz opened this issue Aug 31, 2022 · 6 comments

Comments

@TearDownTheWallz
Copy link

Environment

Liquibase Version: 4.15.0

Liquibase Integration & Version: Liquibase command line

Database Vendor & Version: com.oracle.database.jdbc:ojdbc11

Operating System Type & Version: Windows 10

Infrastructure Type/Provider: Local

Description

When executing the command for generating a changelog, against a larger schema, after ~15-20 min. the execution ends with an error

[2022-08-30 11:05:24] SEVERE [liquibase.integration] java.lang.StackOverflowError
java.lang.StackOverflowError

Executing the command with logLevel=debug provides the following log

[2022-08-30 11:05:24] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing SCHEMA.PACKAGE with 65 incoming nodes
[2022-08-30 11:05:24] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing SCHEMA.PACKAGE with 66 incoming nodes
[2022-08-30 11:05:24] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing SCHEMA.PACKAGE with 66 incoming nodes
[2022-08-30 11:05:24] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing SCHEMA.PACKAGE with 66 incoming nodes
[2022-08-30 11:05:24] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing SCHEMA.PACKAGE with 66 incoming nodes
[2022-08-30 11:05:24] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing SCHEMA.PACKAGE with 66 incoming nodes
[2022-08-30 11:05:24] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing SCHEMA.PACKAGE with 66 incoming nodes
[2022-08-30 11:05:24] SEVERE [liquibase.integration] java.lang.StackOverflowError
java.lang.StackOverflowError
	at liquibase.util.DependencyUtil$DependencyGraph.recursiveSizeDepth(DependencyUtil.java:144)
	at liquibase.util.DependencyUtil$DependencyGraph.recursiveSizeDepth(DependencyUtil.java:144)
    + Around 1000 rows
    + at liquibase.util.DependencyUtil$DependencyGraph.recursiveSizeDepth(DependencyUtil.java:144)
	at liquibase.util.DependencyUtil$DependencyGraph.recursiveSizeDepth(DependencyUtil.java:122)
	at liquibase.util.DependencyUtil$DependencyGraph.computeDependencies(DependencyUtil.java:88)
	at liquibase.util.DependencyUtil$DependencyGraph.computeDependencies(DependencyUtil.java:111)

log_file.txt

Database Meta Data

Indexes - 731
Packages - 249
Procedures - 2
Sequences - 178
Synonyms - 548
Tables - 480
Triggers - 6
Types - 509
Views - 372

Note: The command has been successfully executed against a couple of smaller schemas.
Note 2: The bug has been discovered on version 4.12. After upgrade, the bug was still present.

Steps To Reproduce

Execute the command to generate a changelog against a larger database schema

liquibase --logLevel=debug --defaultsFile=HopeItWorks.properties --changelog-file=Changelogs\YY_CHANGE_LOG.xml generate-changelog --includeSchema=true

Actual Behavior

After some time the execution raises the above-mentioned error

Expected/Desired Behavior

The changelog should be generated successfully.

@alf
Copy link

alf commented Sep 2, 2022

I'm experiencing something similiar using 4.9.1 on linux. When I try to do generate a data changelog it hangs for quite a while before it errors out. The problem for me is the recursive method computeDependencies.

The problem could be that the database is too large, however it fails even with -Xss1G. Undetected cycles maybe?

@boberbober8083
Copy link

liquibase do not allow to proceed depths > 1000 (hardcoded constant inside method private int recursiveSizeDepth, it's a simple protection from StackOverflowError.
Probably, this constant could be calculated in runtime, for example we can detect max allowable stack depth just in runtime (just on startup for example?).

@vinodsheru
Copy link

I am getting the same error as mentioned by @x3ReMe can someone please help me in resolving this issue, I am generating a changelog on a large database

@hanouard
Copy link

hanouard commented Jun 6, 2023

Im using v4.20.0 for generating changelog from a large oracle database and facing the same problem only on Linux VM. On my local machine with windows 11 it's working great.

I will try to play with the -Xss as did @alf but to make it fail on windows: tried it on windows with -Xss1k and still works.

@mickevrolijk-of
Copy link

I am facing the same issue on v4.23.0. Although I have a large schema, I also observe that the query on USER/DBA_DEPENDENCIES ignores the differences between packages and package bodies, so it is way easier to run into cycles and thus into stack overflows?

With some developers, liquibase runs fine. It turns out that the condition to switch between DBA_DEPENDENCIES and USER_DEPENDENCIES is buggy and works only correctly with an English client setting. The developers which were served non-English error messages had no issues. We are now using this as a workaround. But why do we then need the dependencies? Is it possible to have a switch in liquibase.properties that disables this logic?

@adragoset
Copy link

adragoset commented Nov 30, 2023

Im running into this issue as well on 4.25.0 executing on a linux host. The DB is oracle and has a large schema that has a lot of packages. generate-changelog has been running for 10 hours. Mine never has a stack overflow its just taking forever to move on once it decides theres some sort of cyclical dependency on that object.

Ive got a log filled with messages like this:

[2023-11-30 21:34:11] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing APPS.QPR_COS_ALLHIER_L_V with 2 incoming nodes

[2023-11-30 21:36:34] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing APPS.QPR_DSB_ALLHIER_L_V with 2 incoming nodes

[2023-11-30 21:38:57] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing APPS.QPR_PRD_ALLHIER_V with 2 incoming nodes

[2023-11-30 21:41:18] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing APPS.QPR_MGB_ALLHIER_L_V with 2 incoming nodes

[2023-11-30 21:43:39] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing APPS.QPR_OAD_ALLHIER_L_V with 2 incoming nodes

[2023-11-30 21:46:03] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing APPS.EDR_FWK_TEST_DL with 2 incoming nodes

[2023-11-30 21:48:25] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing APPS.EDR_FWK_TEST_IL with 2 incoming nodes

[2023-11-30 21:50:46] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing APPS.EDR_FWK_TEST_UL with 2 incoming nodes

[2023-11-30 21:53:07] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing APPS.GL_RGXCOLD_XMLP_PKG with 2 incoming nodes

[2023-11-30 21:55:27] FINE [liquibase.util] Potential StackOverflowException. Pro-actively removing APPS.GL_PA_AUTOALLOC_PKG with 2 incoming nodes

Ive tried setting the --diff-types argument on the generate-changelog command however it seems liquibase is still trying to crawl the dependency tree for every object in the schema. It's unfortunate because only care about a dozen views and tables in this particular schema and was hoping to get a changelog for them like i have for other schemas in the same DB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Open Issues
Development

No branches or pull requests