Automating Object Transformations for Dynamic Software Updating via Online Execution Synthesis

Tianxiao Gu, Xiaoxing Ma, Chang Xu, Yanyan Jiang, Chun Cao, Jian LuECOOP 2018 · OpenReview

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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

Abstract

Dynamic software updating (DSU) is a technique to upgrade a running software system on the fly without stopping the system. During updating, the runtime state of the modified components of the system needs to be properly transformed into a new state, so that the modified components can still correctly interact with the rest of the system. However, the transformation is non-trivial to realize due to the gap between the low-level implementations of two versions of a program. This paper presents AOTES, a novel approach to automating object transformations for dynamic updating of Java programs. AOTES bridges the gap by abstracting the old state of an object to a history of method invocations, and re-invoking the new version of all methods in the history to get the desired new state. AOTES requires no instrumentation to record any data and thus has no overhead during normal execution. We propose and implement a novel technique that can synthesize an equivalent history of method invocations based on the current object state only. We evaluated AOTES on software updates taken from Apache Commons Collections, Tomcat, FTP Server and SSHD Server. Experimental results show that AOTES successfully handled 51 of 61 object transformations of 21 updated classes, while two state-of-the-art approaches only handled 11 and 6 of 61, respectively.
BibTeX
@inproceedings{gu2018automating,
  author = {Tianxiao Gu and Xiaoxing Ma and Chang Xu and Yanyan Jiang and Chun Cao and Jian Lu},
  title = {{Automating Object Transformations for Dynamic Software Updating via Online Execution Synthesis}},
  booktitle = {ECOOP},
  year = {2018},
  url = {https://openreview.net/forum?id=nJL7FrJZM2},
}
Figure