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

Meta context must be set before serialization, please set meta context by SerializationContext.setMetaContext #1692

Open
1 of 2 tasks
naah69 opened this issue Jun 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@naah69
Copy link

naah69 commented Jun 20, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

java:jdk17
fury:0.5.0

Component(s)

Java

Minimal reproduce step

when use multithread

    private static ThreadSafeFury getBuildThreadSafeFury() {
        return Fury.builder().withLanguage(Language.JAVA)
                   .requireClassRegistration(false)
                   .withRefTracking(false)
                   .withMetaContextShare(true)
                   .withIntCompressed(true)
                   .withLongCompressed(true)
                   .withStringCompressed(true)
                   .withCompatibleMode(CompatibleMode.COMPATIBLE)
                   .withClassLoader(CLASS_LOADER)
                   .buildThreadSafeFury();
    }

 fury.serialize(source);

What did you expect to see?

no exception

What did you see instead?

java.lang.NullPointerException: Meta context must be set before serialization, please set meta context by SerializationContext.setMetaContext
    at org.apache.fury.util.Preconditions.checkNotNull(Preconditions.java:33)
    at org.apache.fury.resolver.ClassResolver.writeClassWithMetaShare(ClassResolver.java:1256)
    at org.apache.fury.resolver.ClassResolver.writeClass(ClassResolver.java:1240)
    at org.apache.fury.Fury.write(Fury.java:313)
    at org.apache.fury.Fury.serialize(Fury.java:248)
    at org.apache.fury.Fury.serialize(Fury.java:220)
    at org.apache.fury.ThreadLocalFury.serialize(ThreadLocalFury.java:91)
    at com.mindflow.common.event.recovery.EventBusExceptionRecover.serializeObject(EventBusExceptionRecover.java:157)
    at com.mindflow.common.event.recovery.EventBusExceptionRecover.save(EventBusExceptionRecover.java:108)
    at com.mindflow.common.exception.mapper.EventExceptionMapper.lambda$handle$1(EventExceptionMapper.java:66)
    at java.util.Optional.ifPresent(Optional.java:178)
    at com.mindflow.common.exception.mapper.EventExceptionMapper.lambda$handle$2(EventExceptionMapper.java:66)
    at java.util.Optional.ifPresent(Optional.java:178)
    at com.mindflow.common.exception.mapper.EventExceptionMapper.handle(EventExceptionMapper.java:66)
    at com.mindflow.common.exception.mapper.EventExceptionMapper.handle(EventExceptionMapper.java:30)
    at io.vertx.core.impl.ContextBase.reportException(ContextBase.java:199)
    at io.vertx.core.impl.DuplicatedContext.reportException(DuplicatedContext.java:108)
    at io.vertx.core.impl.future.FutureImpl$2.onFailure(FutureImpl.java:117)
    at io.vertx.core.impl.future.FutureBase.lambda$emitFailure$1(FutureBase.java:69)
    at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:833)

Anything Else?

image image

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@naah69 naah69 added the bug Something isn't working label Jun 20, 2024
@chaokunyang
Copy link
Collaborator

chaokunyang commented Jun 20, 2024

As the error message said, you need to set meta context before serializing. This is an advanced feature. We have a new option scopedMetaShare, which can set meta context automatically, but it is still in main branch

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