Skip to content

Light-4J (2.0.20) - wrong IPs is used in the LightCluster.discovery() method #2375

Open
@mihai-vladuc

Description

@mihai-vladuc

Here’s a summary of the issue as per chronological order.

1, When Light-4J starts, the serviceMap container has the target IP (e.g. 10.10.10.10)

  1. When target changes IP (e.g. 11.11.11.11) , this method will first look at the cache (serviceMap) and if there exists use that.

  2. Issue is the serviceMap contains old IP (10.10.10.10)

  3. Hence wrong IP being used and hence it blows up since IP 10.10.10.10 no longer exists

Here’s the code:

private List discovery(String protocol, String serviceId, String tag) {
if(logger.isDebugEnabled()) logger.debug("protocol = " + protocol + " serviceId = " + serviceId);
// lookup in serviceMap first, if not there, then subscribe and discover.
List urls = serviceMap.get(serviceId);
if(logger.isDebugEnabled()) logger.debug("cached serviceId " + serviceId + " urls = " + urls);
if((urls == null) || (urls.isEmpty())) {
URL subscribeUrl = URLImpl.valueOf(protocol + "://localhost/" + serviceId);
if(tag != null) {
subscribeUrl.addParameter(Constants.TAG_ENVIRONMENT, tag);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions