Skip to content

[BUG] Eureka watcher misses same-instance metadata updates because equality compares only identity #7439

Open

Description

@Aias00

Is there an existing issue for this?

  • I searched existing open and closed issues.

Current Behavior

The Eureka watcher checks whether an instance has changed using the following predicate:

currentInstance.getInstanceId().equals(previousInstance.getInstanceId())
    && !currentInstance.equals(previousInstance)

Netflix Eureka InstanceInfo.equals() compares identity rather than all instance properties. For an instance retaining its identity, changes to upstream-relevant data do not satisfy the update predicate. The addition/deletion checks also see the instance as unchanged, so no event is emitted.

Expected Behavior

A stable instance identity with changed upstream information should emit ChangedEventListener.Event.UPDATED and refresh the gateway's upstream data.

Steps To Reproduce

  1. Create two real Eureka InstanceInfo snapshots with the same explicit instance ID, application, address and port.
  2. Set the old snapshot's metadata.weight to 10 and the new snapshot's weight to 20.
  3. Compare the snapshots through EurekaInstanceRegisterRepository.compareInstances().
  4. Observe that no UPDATED event is delivered although buildUpstreamJsonFromInstance() would generate different weight data.

Use real InstanceInfo objects in the regression so the dependency's identity-based equality is exercised; a plain Mockito mock uses different equality semantics.

Environment

ShenYu 2.7.2-SNAPSHOT, master at 67596c1d228b62da75cd0a0ecb47d0ac5d995384, Eureka instance discovery.

Location And Impact

Severity: Medium. Confidence: high. In-place changes to weight, protocol, props and other upstream fields can leave ShenYu discovery data stale despite successful ongoing polling. This report does not assume every Eureka status change remains present in the upstream fetch result.

Suggested Fix And Regression Coverage

Match snapshots by stable identity, then compare the upstream-relevant fields or their generated upstream representation. Preserve distinct ADDED and DELETED handling. Test same-ID weight/protocol/props changes using real dependency objects and assert an UPDATED event with the new payload.

Validation And Related Issues

Existing Eureka module tests passed 3 tests with zero failures, but do not cover real same-ID mutable-field comparison. No live Eureka cluster was started.

Independent verification inspected the actual Eureka 2.0.2 dependency source and reproduced identity equality with two real InstanceInfo snapshots having the same ID but different metadata/status: equality remains true and hashes match.

#6500/#7429 address keeping the polling task alive after errors. #6904 concerns namespace filtering. This is the separate update-detection predicate used by otherwise successful polls.

Activity

  1. github-actions commented on Oct 6, 2026

    @github-actions
    Contributor

    👋 Hello @yuluo-yx

    A new issue has been opened by @Aias00:

    Please review when you have time. Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions