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

Very large protobuf messages cause a StackOverflowError on Kotlin/JS #267

Open
garyp opened this issue Jul 1, 2024 · 0 comments
Open

Very large protobuf messages cause a StackOverflowError on Kotlin/JS #267

garyp opened this issue Jul 1, 2024 · 0 comments
Labels

Comments

@garyp
Copy link
Collaborator

garyp commented Jul 1, 2024

This can be reproduced by un-excluding the test_compiler_limits.kt file that's currently excluded for Kotlin/JS in https://github.com/streem/pbandk/blob/master/test-types/build.gradle.kts. The compiler will fail with a StackOverflowError and a stack trace similar to:

e: java.lang.StackOverflowError                                                        
        at org.jetbrains.kotlin.ir.backend.js.utils.serialization.JsIrAstSerializer.writeExpression(JsIrAstSerializer.kt:783)
        at org.jetbrains.kotlin.ir.backend.js.utils.serialization.JsIrAstSerializer.access$writeExpression(JsIrAstSerializer.kt:82)
        at org.jetbrains.kotlin.ir.backend.js.utils.serialization.JsIrAstSerializer$writeExpression$visitor$1.visitBinaryExpression(JsIrAstSerializer.kt:478)
        at org.jetbrains.kotlin.js.backend.ast.JsBinaryOperation.accept(JsBinaryOperation.java:47)
        at org.jetbrains.kotlin.ir.backend.js.utils.serialization.JsIrAstSerializer.writeExpression(JsIrAstSerializer.kt:549)
        at org.jetbrains.kotlin.ir.backend.js.utils.serialization.JsIrAstSerializer.access$writeExpression(JsIrAstSerializer.kt:82)
        at org.jetbrains.kotlin.ir.backend.js.utils.serialization.JsIrAstSerializer$writeExpression$visitor$1.visitBinaryExpression(JsIrAstSerializer.kt:478)
        at org.jetbrains.kotlin.js.backend.ast.JsBinaryOperation.accept(JsBinaryOperation.java:47)
        ...

I have not been able to narrow down which specific portion of the generated code is causing the stack overflow. But it seems to be related to the number of fields in MessageWithLotsOfFields.

@garyp garyp added bug Something isn't working platform-js component-codegen labels Jul 1, 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

1 participant