[frs-268] ColdFusion/BCEL Compiler emits a Class Format Exception: “Invalid method signature”

Problem

You may see the following message in ColdFusion's logfile, at the head of a stack trace:

org.apache.bcel.classfile.ClassFormatException: Invalid method signature: ;)Ljava/lang/Object;

The actual method signature, ;)Ljava/lang/Object; may differ.

No ColdFusion page is generated. This exception may be displayed in the browser instead.

Analysis

Root Cause

The root cause appears to be as follows:

  • ColdFusion parses CFML grammar and builds an internal representation of the grammar. This is known variously as an Intermediate Representation (IR), which can be written in a target-neutral Intermediate Lanaguge. Often, an in-memory representation of the source is stored as an Abstract Syntax Tree (AST).
  • ColdFusion converts the AST to java bytecode. This can be run directly on the Java Virtual Machine (JVM).
  • ColdFusion uses the BCEL library to verify and write the bytecode to class files, for caching.

During the last step, BCEL emits an exception that the given method signature is not valid. In the case of our exemplar, the method signature actually is not valid: ;)Ljava/lang/Object; contains the return type (a java.lang.Object) and part of the method parameters (😉) which have been truncated.

The reason for the truncation is not known, since we have been unable to reproduce this case, so the following is (educated) conjecture:

  1. Either the ColdFusion or BCEL libraries are not threadsafe, and information from another thread has contaminated the compilation of a ColdFusion page;
  2. The CF or BCEL libraries were interrupted during a long compile; however one might expect information to be truncated from the end of a string, rather than the start.

Occurrences

This bug seems to occur with or without FusionReactor installed, from time periods spanning several releases. We do not believe at this time that FR is a causative factor in this bug. There are some documented cases of similar issues with BCEL. The library is not thread-safe, so attempting to compile several ColdFusion pages at one time might trigger it.

If the bug is actually related to thread-safety, it will be extremely sensitive to timing. It appears to be quite rare, and difficult to reproduce.

Workaround/Fixes

Causing ColdFusion to recompile the page should alleviate the problem:

  • CF Administrator -> Caching -> Clear Template Cache / Clear Component Cache

The presence of FR should not affect the likelihood of this bug occurring.

If you have a repeatable case, where this bug can be exercised at will, please get in touch with us: support@fusion-reactor.com – we'd love to hear from you.

Issue Details

Type: Technote
Issue Number: FRS-268
Components: Request Managment
Environment:
Resolution: Fixed
Last Updated: 04/Oct/11 12:31 PM
Affects Version:
Fixed Version: Pending
Server:
Platform:
Related Issues:

Comments are closed.