Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]More than one state exists in fetch thread state machine. #5

Open
ShanceWang opened this issue May 12, 2022 · 1 comment
Open
Labels
bug Something isn't working

Comments

@ShanceWang
Copy link
Collaborator

Environment

  • Ptubes version: 1.0.0

  • Operating System version: Linux

  • Java version: 1.8

Steps to reproduce this issue

The "onChannelDisconnect" function in class NettyHttpRdsCdcReaderConnection will enqueue another state object into "messageQueue" of the fetch thread When the netty connection is lost.

    private void onChannelDisconnect() {
        log.warn("Fetch thread disconnected from remote server " + targetServer);

        if (!this.getState()
            .equals(State.CLOSING) && !this.getState()
            .equals(State.CLOSED)) {

            this.fetchThreadState.setStateId(FetchThreadState.StateId.PICK_SERVER);
            this.fetchThread.enqueueMessage(this.fetchThreadState); // it is
            this.setState(State.CLOSED);
        } else {
            log.warn("Fetch thread connection is already closed.");
        }
    }

The bug may cause a data loss risk. Because two state in "messageQueue" of the fetch thread will cause two fetching reader event in a short time. Meanwhile, the dispatch class is a a non-thread-safe while doing events distribution.

Expected Behavior

Only one state object contains in the "messageQueue" of the fetch thread.

Actual Behavior

There is more than one state object exists in "messageQueue" of the fetch thread.

@ShanceWang ShanceWang added the bug Something isn't working label May 12, 2022
@myksl
Copy link
Collaborator

myksl commented May 20, 2022

hi, shance,I saw this problem, I tried to follow your process and found that it can be reproduced, it is a bug, we need to fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants