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

Specific gateway events are triggering a StackOverflowError when printing the RawGatewayEvent.package #2333

Closed
3 tasks done
MrPowerGamerBR opened this issue Nov 16, 2022 · 0 comments · Fixed by #2334
Closed
3 tasks done
Labels

Comments

@MrPowerGamerBR
Copy link
Contributor

General Troubleshooting

  • I have checked for similar issues on the Issue-tracker.
  • I have updated to the latest JDA version
  • I have checked the branches or the maintainers' PRs for upcoming bug fixes.

Expected Behaviour

When printing the gateway event, a StackOverflowError shouldn't happen.

However, specific events (from what I've noticed, MESSAGE_CREATE and MESSAGE_UPDATE) triggers a StackOverflowError.

This does not happen if you print the event before it is processed by JDA, so it looks like something when processing the event causes a cyclic dependency to happen in the DataObject, which triggers this error.

Code Example for Reproduction Steps

override fun onRawGateway(event: RawGatewayEvent) {
        try {
            println(event.type)
            println(event.`package`)
        } catch (e: Error) {
            println("Something went wrong!")
            println(e.stackTraceToString().take(1000))
        }
    }

Code for JDABuilder or DefaultShardManagerBuilder used

JDABuilder.createDefault("owo")
        .setRawEventsEnabled(true)
        .addEventListeners(
            object: ListenerAdapter() {
                override fun onRawGateway(event: RawGatewayEvent) {
                    try {
                        println(event.type)
                        println(event.`package`)
                    } catch (e: Error) {
                        println("Something went wrong!")
                        println(e.stackTraceToString().take(1000))
                    }
                }
            }
        )
        .build()

Exception or Error

MESSAGE_CREATE
Something went wrong!
java.lang.StackOverflowError
	at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:69)
	at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:808)
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeWithoutTypeInfo(MapSerializer.java:764)
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:720)
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:35)
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:808)
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeWithoutTypeInfo(MapSerializer.java:764)
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:720)
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(Ma

MESSAGE_UPDATE
Something went wrong!
java.lang.StackOverflowError
	at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.forSerialization(BasicClassIntrospector.java:80)
	at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.forSerialization(BasicClassIntrospector.java:11)
	at com.fasterxml.jackson.databind.SerializationConfig.introspect(SerializationConfig.java:862)
	at com.fasterxml.jackson.databind.ser.BasicSerializerFactory.createKeySerializer(BasicSerializerFactory.java:210)
	at com.fasterxml.jackson.databind.SerializerProvider.findKeySerializer(SerializerProvider.java:903)
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.createContextual(MapSerializer.java:516)
	at com.fasterxml.jackson.databind.SerializerProvider.handleSecondaryContextualization(SerializerProvider.java:1113)
	at com.fasterxml.jackson.databind.SerializerProvider.findContentValueSerializer(SerializerProvider.java:788)
	at com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap.findAndAddSecondarySeri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants