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

[CURATOR-663] ZooKeeperServerEmbeddedAdapter.configure might fail with ClassCastException #1178

Open
jira-importer opened this issue Mar 28, 2023 · 1 comment

Comments

@jira-importer
Copy link
Collaborator

There might be a ClassCastException happening when starting the TestingZooKeeper instance. The following test reproduces the issue:

@Test
public void testTestingZooKeeperServer() throws Exception
{
  final Map<String, Object> customProperties = new HashMap<>();
  customProperties.put("maxSessionTimeout", 60_000);

final Path tmpDirPath = Files.createTempDirectory("tmp-");
final InstanceSpec instanceSpec = new InstanceSpec(tmpDirPath.toFile(), 0, 0, 0, true, 0, 10, 1, customProperties, "host-name");
final QuorumConfigBuilder quorumConfigBuilder = new QuorumConfigBuilder(instanceSpec);
final TestingZooKeeperServer zkServer = new TestingZooKeeperServer(quorumConfigBuilder);

zkServer.start();
}

The test above will fail with a ClassCastException because InstantSpec allows a Map for custom properties, i.e. a non-String value like Integer can be used.

This Map is then passed over into a Properties instance in QuorumConfigBuilder:163. These Properties are then written to a temporary file in ZooKeeper's ZooKeeperServerEmbeddedImpl:58 which expects only to have String values. The previously set Integer value isn't converted to a String anywhere, though.


Originally reported by mapohl, imported from: ZooKeeperServerEmbeddedAdapter.configure might fail with ClassCastException
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2025-01-21
@jira-importer
Copy link
Collaborator Author

tison:

Seems change the type of InstanceSpec#customProperties could resolve this?

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

No branches or pull requests

1 participant