Commit b05eb1c
committed
Fix StackOverflowError during "Apply changes to the internal targets model"
Problem: `calculateOutputJarsLibraries()` was creating synthetic dependencies from targets
to output_jars libraries that already exist as real targets. For example, with BUILD file:
```starlark
proto_library(
name = "proto",
srcs = glob(["proto/**/*.proto"]),
strip_import_prefix = "proto",
)
java_proto_library(
name = "proto_output_jars",
deps = [":proto"],
)
```
The plugin would create a synthetic dependency proto -> proto_output_jars,
combined with the real dependency proto_output_jars -> proto, creating cycles:
proto -> proto_output_jars -> proto -> proto_output_jars -> ...
This resulted in infinite recursion and `StackOverflowError` in `calculateTransitivelyExecutableTargets`
during the "Apply changes to the internal targets model" sync phase, causing sync to hang.
Stack trace excerpt:
```
at org.jetbrains.bazel.target.TargetUtils.calculateTransitivelyExecutableTargets(TargetUtils.kt:206)
at org.jetbrains.bazel.target.TargetUtils.access$calculateTransitivelyExecutableTargets(TargetUtils.kt:60)
at org.jetbrains.bazel.target.TargetUtils$calculateTransitivelyExecutableTargets$1$1.invoke(TargetUtils.kt:216)
at org.jetbrains.bazel.target.TargetUtils$calculateTransitivelyExecutableTargets$1$1.invoke(TargetUtils.kt:215)
[infinite recursion continues...]
```
Solution: rename the suffix so that a clash is less likely1 parent d216598 commit b05eb1c
File tree
1 file changed
+1
-1
lines changed- plugin-bazel/src/main/kotlin/org/jetbrains/bazel/sync/workspace/mapper/normal
1 file changed
+1
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
| 261 | + | |
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| |||
0 commit comments