gatekeeper icon indicating copy to clipboard operation
gatekeeper copied to clipboard

Gatekeeper fails to update config with cast exception

Open CoreyBehrends opened this issue 9 years ago • 4 comments

First off, great project! Very clever.

My only issue is that it appears to blow up when a config updates on Zookeeper. Below is the stack trace. Any insight would be greatly appreciated. I'm more than happy to help in any way I can.

java.lang.ClassCastException: Cannot cast java.util.LinkedHashMap to java.lang.Void at java.lang.Class.cast(Class.java:3369) ~[na:1.8.0_40] at org.apache.curator.x.discovery.details.JsonInstanceSerializer.deserialize(JsonInstanceSerializer.java:51) ~[gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at org.apache.curator.x.discovery.details.ServiceCacheImpl.addInstance(ServiceCacheImpl.java:180) ~[gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at org.apache.curator.x.discovery.details.ServiceCacheImpl.childEvent(ServiceCacheImpl.java:142) ~[gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:516) [gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:510) [gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92) [gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299) [gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:84) [gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:508) [gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35) [gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at org.apache.curator.framework.recipes.cache.PathChildrenCache$9.run(PathChildrenCache.java:759) [gatekeeper-agent-1.1.0-SNAPSHOT.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_40] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_40] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_40] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_40] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_40] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_40] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]

CoreyBehrends avatar May 29 '15 12:05 CoreyBehrends

@CoreyBehrends Sorry to hear you're having issues, I'm happy to help you resolve it.

Could you tell me a little bit about how you're registering your service instances in Zookeeper?

Xorlev avatar May 30 '15 00:05 Xorlev

Michael,

I've found the issue and have it running in my test environment. In your release notes for 1.0.0 you mention 90% test coverage, however I've not been able to find them. If you have a test suite, I'd be more than happy to run it against my (very minor) changes and submit a potential patch.

For what it's worth, I've extended this project https://github.com/jplock/dropwizard-discovery.git to send updates to Zookeeper via Curator.

On Fri, May 29, 2015 at 7:33 PM, Michael Rose [email protected] wrote:

@CoreyBehrends https://github.com/CoreyBehrends Sorry to hear you're having issues, I'm happy to help you resolve it.

Could you tell me a little bit about how you're registering your service instances in Zookeeper?

— Reply to this email directly or view it on GitHub https://github.com/Xorlev/gatekeeper/issues/20#issuecomment-106967215.

Corey Behrends Pro Athlete, Inc. 10800 North Pomona Ave Kansas City, MO 64153 Direct: 816-659-8619 816-587-6050 www.proathleteinc.com

CoreyBehrends avatar May 30 '15 00:05 CoreyBehrends

Gatekeeper currently does not have 90% test coverage. The release notes were admitting omission. Given that this is starting to get used outside our environment I'll commit some extra tests this weekend and get public coverage setup.

Feel free to PR your changes and I'll merge them in after some testing.

I imagine the issue was that the plugin actually uses instance metadata and not void like Gatekeeper assumes.

Xorlev avatar May 30 '15 01:05 Xorlev

You're exactly correct. The deserialization of the stream from Zk was failing due to "Void" not being valid when the serializer returned a List.

I"m sorry I misread the release notes. I'll cover my changes with tests as best I can and submit a PR this weekend.

On Fri, May 29, 2015 at 8:01 PM, Michael Rose [email protected] wrote:

Gatekeeper currently does not have 90% test coverage. The release notes were admitting omission. Given that this is starting to get used outside our environment I'll commit some extra tests this weekend and get public coverage setup.

Feel free to PR your changes and I'll merge them in after some testing.

I imagine the issue was that the plugin actually uses instance metadata and not void like Gatekeeper assumes.

— Reply to this email directly or view it on GitHub https://github.com/Xorlev/gatekeeper/issues/20#issuecomment-106968980.

Corey Behrends Pro Athlete, Inc. 10800 North Pomona Ave Kansas City, MO 64153 Direct: 816-659-8619 816-587-6050 www.proathleteinc.com

CoreyBehrends avatar May 30 '15 01:05 CoreyBehrends