TL;DR
This paper introduces AOTES, an automated approach for transforming object states during dynamic software updates in Java. By synthesizing a history of method invocations from an object's current state, AOTES can recreate the object in its new version without requiring manual transformers or runtime instrumentation, significantly outperforming existing methods.
What Problem Does This Paper Address?
Dynamic Software Updating (DSU) allows software to be upgraded while it's running, avoiding downtime. A critical challenge in DSU is ensuring that the runtime state of objects from the old software version can be correctly transformed into a state compatible with the new version. This "object transformation" is difficult because the internal implementations of the old and new versions of a program can differ significantly, creating a gap that manual "state transformers" must bridge. Developing these transformers is error-prone and requires deep knowledge of both program versions, often breaking encapsulation principles. Existing automated approaches struggle with transformations involving changes in field names or types.
Methods
AOTES tackles object transformation by leveraging the idea that an object's current state is a consequence of its past method invocations. The core idea is to:
- Synthesize an Invocation History: Instead of directly mapping old states to new states, AOTES reconstructs a history of method calls that led to the object's current state in the old version. This history is synthesized from the current state alone, without needing to log method calls during normal execution.
- Replay with New Version: This synthesized history is then replayed using the new version of the methods to generate the desired state for the updated object.
- Offline Analysis & Online Synthesis:
- Offline: AOTES uses symbolic execution to analyze matched methods (methods present in both versions with the same signature) and generate "inverse methods." These inverse methods allow for backward reasoning about method calls. It also distills promising execution paths.
- Online: During an update, AOTES uses these inverse methods to synthesize an equivalent, compact invocation history by working backward from the current object state. This synthesized history is then inverted and replayed with the new method versions.
A key innovation is synthesizing the invocation history from the current state, avoiding the overhead of runtime logging.
Datasets
The evaluation was performed on 21 updated classes from widely used open-source software:
- Apache Commons Collections
- Apache FTP Server
- Apache SSHD Server
- Apache Tomcat
These updates were chosen because they involved field changes (value, name, or type) and were successfully compiled in both versions.
Key Insights and Ideas
- State as a History: The fundamental insight is that an object's current state is a summary of its past method invocations. This allows us to reconstruct the state by replaying past actions.
- Synthesizing from Current State: The ability to synthesize an equivalent invocation history solely from the current object state is crucial. This bypasses the need for explicit state logging during normal operation, eliminating runtime overhead.
- Inverse Methods for Backward Reasoning: Using inverse methods derived from symbolic execution enables a backward synthesis approach, which is more effective than forward approaches when starting from a known state.
- Automating Complex Transformations: AOTES can handle transformations involving name and type changes in fields by inferring relationships through method arguments, something simpler approaches cannot do.
Key Results
- AOTES successfully handled 51 out of 61 object transformations across 21 updated classes.
- In comparison, two state-of-the-art approaches handled only 11 and 6 transformations, respectively.
- The approach demonstrated effectiveness on various types of field changes, including name and type changes, which are common in real-world software evolution.
- The micro benchmark showed that synthesizing histories can be efficient, especially when using previously discovered inverse methods, with worst-case times in milliseconds.
Limitations and Future Work
- Native Methods: A significant limitation is the handling of uninterpreted native methods. AOTES can only handle a limited subset, and their presence can lead to incomplete or inconsistent synthesized histories. Future work includes supporting more native methods.
- Inconsistent Histories: In some cases, AOTES produced inconsistent histories, meaning the state in the new version didn't match what was expected. This was sometimes due to the inability to distinguish between different actual histories that lead to the same current state, especially when setters or constructors could be invoked in different orders.
- Assumptions: The approach relies on the assumption that the object's "role" or behavior doesn't change drastically during updates. Violations of this assumption can lead to issues.
- Solver Integration: The current implementation uses a trivial solver. Integrating more powerful SMT solvers (like Z3) is planned to improve effectiveness.
- Search Strategies: Exploring more efficient search strategies for inverse methods and potentially sharing search strategies across different transformations are areas for future improvement.
Summary updated