SUGGESTED FIX
------- systemDictionary.cpp -------
*** /tmp/geta12120 Fri Oct 10 16:59:36 2003
--- /tmp/getb12120 Fri Oct 10 16:59:36 2003
***************
*** 1777,1793 ****
symbolOop check = find_placeholder(index, name, class_loader);
if (check != NULL) {
remove_placeholder(index, name, class_loader);
- klassOop sd_check = find_class(index, name, class_loader);
- if (sd_check == NULL) {
- add_klass(index, name, class_loader, k);
- notice_modification();
- } else {
- // Note that in the current system we do not expect to
- // encounter this case. This may change in the future.
- }
}
- #ifdef ASSERT
klassOop sd_check = find_class(index, name, class_loader);
assert (sd_check != NULL, "should have entry in system dictionary");
symbolOop ph_check = find_placeholder(index, name, class_loader);
assert (ph_check == NULL, "should not have a placeholder entry");
--- 1777,1790 ----
symbolOop check = find_placeholder(index, name, class_loader);
if (check != NULL) {
remove_placeholder(index, name, class_loader);
}
klassOop sd_check = find_class(index, name, class_loader);
+ if (sd_check == NULL) {
+ add_klass(index, name, class_loader, k);
+ notice_modification();
+ }
+ #ifdef ASSERT
+ sd_check = find_class(index, name, class_loader);
assert (sd_check != NULL, "should have entry in system dictionary");
symbolOop ph_check = find_placeholder(index, name, class_loader);
assert (ph_check == NULL, "should not have a placeholder entry");
|
EVALUATION
This may be a duplicate of 4846301. Thanks Jane..
###@###.### 2003-09-24
The following sequence will lead to such a crash:
0) loader1 loads and defines B.
1) Class C which extends B is loaded from resolve_instance_class_or_null()
by loader 2.
2) A placeholder (C, loader2) is added to the system dictionary.
3) loader 2 loads C and defines C, which in turn resolves B, C's super class,
in resolve_super_or_fail().
4) loader 2 delegates the loading of B to loader1, which loads B and tries
to define B. However, loader1 has defined B before, so a "duplicate class
definition" LinkageError is thrown.
5) The exception will make the placeholder (C, loader2) removed in
resolve_from_stream(). Because loader2 fails to define C.
6) loader2's loadClass() however, catches the exception and redelegates
to another loader to finish the loading of C.
7) resolve_instance_class_or_null() is later surprised to find that the
placeholder (C, loader2) is removed (actually by its own thread!). The code
since 1.4.2 will crash in this case.
A testcase containing the above sequence is attached.
###@###.### 2003-09-26
The fix changed the behavior back to that of 1.4.1, i.e. always update
the system dictionary even if the placeholder is removed.
###@###.### 2003-10-10
|