dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

I want to know why.

Open xishian opened this issue 8 years ago • 6 comments

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.
  • [ ] I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.5.8
  • Operating System version: win10
  • Java version: 1.8

Step to reproduce this issue

  1. Write a service to upload file, such as pdf document...
  2. interface maybe like this: Result parseFile(String filename,InputStream inputStream);
  3. Use a specified document test the interface.

reproduce this issue maybe need a specified pdf document.

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

the content of pdf documents.

What do you expected from the above steps?

null, and exceptions below.

What is actually happen?

In fact, the first request throw a SocketTimeoutException, see below, but latter requests reponse correctly. So I guess that is because of initializaton probleam. Then I find when I set timeout=2000 on <dubbo:reference>, everything works rightly. It's very confusing to me. According to exceptions thrown by provider, that is, the consumer doesn't send input stream correcly, and it throws a timeout exception immediately, so provider cannot get input stream, it throws a org.apache.tika.exception.ZeroByteFileException.

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

xishian avatar Aug 31 '18 02:08 xishian

Hi, the dubbo protocol didn't support for stream. I think u can change the protocol to rmi. If u still want to use dubbo protocol, I think u should use byte[] instead of stream. You can fix it and have a try.

If still have problem, pls send us a demo to recreate the problem.

carryxyh avatar Aug 31 '18 02:08 carryxyh

Hi, I will close this issue. Reopen if there still some problems.

carryxyh avatar Sep 03 '18 11:09 carryxyh

@carryxyh Thank you for your information that I did not find anywhere on internet about the streaming incompatibility of dubbo protocol. Our question is apart from the RMI protocol, is there any other protocol (e.g., http) that supports stream? We would like to not use RMI protocol since it will lead to the port randomness nature of JAVA RMI protocol that will clearly not work with system firewall.

DatPhanTien avatar Apr 26 '19 16:04 DatPhanTien

I am not sure about it that whether other protocol support stream. But u can use byte[] instead of stream(Such as FileInputStream) for any protocol.

carryxyh avatar Apr 28 '19 02:04 carryxyh

Dear @carryxyh , thanks for your answer. Apparently, using byte[] will help solving the streaming issue quickly. But using the byte[] leads us to another issue, how the service consumer handle the returning byte[] (in terms of deserialization)? Does Dubbo provides already the serialization and deserialization with data transferred in byte[] or is it the job of the developer to properly deserialize the byte[] of the returning objects?

DatPhanTien avatar Apr 29 '19 11:04 DatPhanTien

Hi @carryxyh We just recently hit this streaming compatibility issue. Of course using byte[] is a possible solution. But there is a good reason that we cannot adopt this approach, that is because of the OOM exception. Do you have any further information on transferring large files with dubbo protocol?

Thx

TotalForgot avatar Jul 18 '19 11:07 TotalForgot