Commit 8c4b8ff
committed
Fix AnnexScalaInstance jar cache misses due to ordering and path comparison problems
The jar cache in AnnexScalaInstance is a ConcurrentHashMap that uses a
string representation of the compiler classpath (a list of jars) as its
key.
Problem is that list of jars which is used to create the key is not
sorted, so you would sometimes get cache misses for the same classpath
because the list had a different ordering.
At a large enough scale, this would cause the JVM to run out of CodeHeap
and crash. Presumably this was because we'd create up to n!
AnnexScalaInstances for every AnnexScalaInstance and then classload for
every single one of those instances.
This change prevents those cache misses and thus prevents the worker
from crashing.
This should also fix cache misses with path mapping by comparing the
short path, so we don't include the bazel arch/config specific parts of
the path.1 parent 6919531 commit 8c4b8ff
File tree
2 files changed
+40
-8
lines changed- src/main/scala/higherkindness/rules_scala/workers/common
2 files changed
+40
-8
lines changedLines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | | - | |
74 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
75 | 84 | | |
76 | 85 | | |
77 | 86 | | |
| |||
84 | 93 | | |
85 | 94 | | |
86 | 95 | | |
87 | | - | |
| 96 | + | |
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
| |||
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
62 | 85 | | |
63 | 86 | | |
64 | 87 | | |
| |||
0 commit comments