dubbo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From luryson (GitHub) <git...@apache.org>
Subject [GitHub] [incubator-dubbo] luryson opened issue #3796: javassist.CannotCompileException: cannot add
Date Tue, 02 Apr 2019 14:17:16 GMT
- [x] I have searched the [issues](https://github.com/apache/incubator-dubbo/issues) of this
repository and believe that this is not a duplicate.
- [x] I have checked the [FAQ](https://github.com/apache/incubator-dubbo/blob/master/FAQ.md)
of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 2.6.0
* Operating System version: MacOS 10.14.3
* Java version: 1.8.0_152

### Steps to reproduce this issue

1. multiple threads access same dubbo method with validation
2.  two threads invoke `com.alibaba.dubbo.validation.support.jvalidation.JValidator.getMethodParameterBean`
at same time
3. thread1 calls `CtClass ctClass = pool.makeClass(parameterClassName);` 
4. thread2 calls `CtClass ctClass = pool.makeClass(parameterClassName);`  before thread1 calls
`CtField ctField = CtField.make("public " + type.getCanonicalName() + " " + fieldName + ";",
pool.getCtClass(parameterClassName));`
5. thread1 calls `CtField ctField = CtField.make("public " + type.getCanonicalName() + " "
+ fieldName + ";", pool.getCtClass(parameterClassName));`, then thread1 get the class which
is generated by thread2
6. thread1 calls `ctClass.addField(ctField);` and throws `javassist.CannotCompileException:
cannot add` 

Pls. provide [GitHub address] to reproduce this issue.

### Expected Result

What do you expected from the above steps´╝č

### Actual Result

What actually happens?

If there is an exception, please attach the exception trace:

```
Just put your stack trace here!
```
```
javassist.CannotCompileException: cannot add
	at javassist.CtClassType.addField(CtClassType.java:1283)
	at javassist.CtClass.addField(CtClass.java:1089)
	at com.alibaba.dubbo.validation.support.jvalidation.JValidator.getMethodParameterBean(JValidator.java:164)
	at com.alibaba.dubbo.validation.support.jvalidation.JValidator.validate(JValidator.java:273)
	at com.alibaba.dubbo.validation.filter.ValidationFilter.invoke(ValidationFilter.java:48)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:61)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:74)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:41)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:77)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:71)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:131)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:37)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:37)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:98)
	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96)
	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:168)
	at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:50)
	at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:79)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
```

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3796 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
Mime
View raw message