Skip to content

[BUG] Embed zookeeper server 'ZKServer' has deadlock problem #3140

@tswstarplanet

Description

@tswstarplanet

*For better global communication, please give priority to using English description, thx! *

Describe the bug
look at the code snippet

    private static synchronized void startLocalZkServer(final int port, final String dataDirPath,final int tickTime,String maxClientCnxns) {
        if (zkServer != null) {
            throw new RuntimeException("Zookeeper server is already started!");
        }
        zkServer = new PublicZooKeeperServerMain();
        logger.info("Zookeeper data path : {} ", dataDirPath);
        dataDir = dataDirPath;
        final String[] args = new String[]{Integer.toString(port), dataDirPath, Integer.toString(tickTime), maxClientCnxns};

        try {
            logger.info("Zookeeper server started ");
            isStarted.compareAndSet(false, true);

            zkServer.initializeAndRun(args);
        } catch (QuorumPeerConfig.ConfigException e) {
            logger.warn("Caught exception while starting ZK", e);
        } catch (IOException e) {
            logger.warn("Caught exception while starting ZK", e);
        }
    }

The above start method will acquire the lock of the ZKServer class. But the line "zkServer.initializeAndRun(args);" will block until the application exit. So it will never release the lock.

    private static synchronized void stopLocalZkServer(final boolean deleteDataDir) {
        // 省略
    }

The above stop method try to acquire the lock of the ZKServer class, but it will never succeed.
To Reproduce
Steps to reproduce the behavior, for example:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Which version of Dolphin Scheduler:
-[1.1.0-preview]

Additional context
Add any other context about the problem here.

**Requirement or improvement

  • Please describe about your requirements or improvement suggestions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions