hedera-sdk-java icon indicating copy to clipboard operation
hedera-sdk-java copied to clipboard

My HelloWorld contract no longer deploys on testnet / previewnet

Open ericleponner opened this issue 2 years ago • 9 comments

Description

I have some code in charge of creating some well-defined contracts with hedera-sdk-java. It's available here: https://github.com/ericleponner/hedera-contract-album

Since a while (since testnet july upgrade?), this code no longer works. Failure is not always the same : most of the time, it's ContractCreateFlow which breaks on TimeoutException

This code has worked flawlessly since february. I don't understand why it's failing now. Help would be welcome.

Steps to reproduce

  1. Make sure you have Java 17 available
  2. Clone https://github.com/ericleponner/hedera-contract-album
  3. Create $HOME/.env with the following data:
OPERATOR_ACCOUNT_ID=0.0.xxx
OPERATOR_KEY={your private key}
HEDERA_NETWORK={network} // testnet or previewnet
  1. Select and run src/main/java/hello_world/HelloWord class with your preferred IDE

After a while you should get the following output:

> Task :HelloWorld.main()
Exception in thread "main" java.util.concurrent.TimeoutException
	at com.hedera.hashgraph.sdk.Executable.execute(Executable.java:396)
	at com.hedera.hashgraph.sdk.Transaction.execute(Transaction.java:54)
	at com.hedera.hashgraph.sdk.ContractCreateFlow.execute(ContractCreateFlow.java:681)
	at com.hedera.hashgraph.sdk.ContractCreateFlow.execute(ContractCreateFlow.java:664)
	at common.Utils.deploy(Utils.java:51)
	at hello_world.HelloWorld.deploy(HelloWorld.java:30)
	at hello_world.HelloWorld.main(HelloWorld.java:12)

> Task :HelloWorld.main() FAILED

Execution failed for task ':HelloWorld.main()'.

Additional context

No response

Hedera network

testnet

Version

v0.40.1

Operating system

macOS

ericleponner avatar Aug 01 '23 16:08 ericleponner

I cannot deploy any of my test contracts anymore. Any workaround to share ? May be another JDK version ?

ericleponner avatar Aug 21 '23 17:08 ericleponner

Hey @ericleponner, thank you for your patience and updating us :slightly_smiling_face: We’re currently investigating it with @thenswan. It is not reproducing for us (We used your code and newer solidity versions to check). I got some errors last week when trying it but nothing now. Can you please try again now if you haven't, and send over some more info you think can be helpful for us to reproduce it, for example your JDK provider.

rokn avatar Aug 22 '23 10:08 rokn

Hi @rokn I just retried: it broke but exception it's another exception. Most of the time, it's TimeoutException. Less often it's MaxAttemptsExceededException.

> Task :HelloWorld.main()
Connecting to previewnet
Operator Account Id: 0.0.1122
Operator Public Key: 302a300506032b6570032100c85edfd88f4454184de8fd88500254e62d2342a3448caf81c7eb26c9d4297e79
Exception in thread "main" com.hedera.hashgraph.sdk.MaxAttemptsExceededException: exceeded maximum attempts for request with last exception being
	at com.hedera.hashgraph.sdk.Executable.execute(Executable.java:391)
	at com.hedera.hashgraph.sdk.Transaction.execute(Transaction.java:54)
	at com.hedera.hashgraph.sdk.ContractCreateFlow.execute(ContractCreateFlow.java:681)
	at com.hedera.hashgraph.sdk.ContractCreateFlow.execute(ContractCreateFlow.java:664)
	at common.Utils.deploy(Utils.java:51)
	at hello_world.HelloWorld.deploy(HelloWorld.java:30)
	at hello_world.HelloWorld.main(HelloWorld.java:12)
Caused by: java.lang.IllegalStateException: Failed to connect to node 0.0.6
	at com.hedera.hashgraph.sdk.Executable$GrpcRequest.reactToConnectionFailure(Executable.java:887)
	at com.hedera.hashgraph.sdk.Executable.execute(Executable.java:411)
	... 6 more
Caused by: java.lang.IllegalStateException: Failed to connect to node 0.0.6


> Task :HelloWorld.main() FAILED

Execution failed for task ':HelloWorld.main()'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk-17.0.8.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.


I'm using Java 17 from Oracle:

pc38:hedera-contract-album eric$ java --version
java 17.0.8 2023-07-18 LTS
Java(TM) SE Runtime Environment (build 17.0.8+9-LTS-211)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.8+9-LTS-211, mixed mode, sharing)

What OS and java version did you use to make your tests ?

ericleponner avatar Aug 22 '23 11:08 ericleponner

Could it be some network issue, have you tried the same thing on a different machine, or more importantly on a different network, maybe using a VPN? We've tested on MacOS, I'm with:

java -version
openjdk version "19.0.1" 2022-10-18
OpenJDK Runtime Environment (build 19.0.1+10-21)
OpenJDK 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)

rokn avatar Aug 22 '23 12:08 rokn

Hey @ericleponner, I tested it on MacOS.

Java:

openjdk 17.0.8 2023-07-18
OpenJDK Runtime Environment Temurin-17.0.8+7 (build 17.0.8+7)
OpenJDK 64-Bit Server VM Temurin-17.0.8+7 (build 17.0.8+7, mixed mode, sharing)

thenswan avatar Aug 22 '23 12:08 thenswan

Thanks. I'll try to alter my environment and see. I noticed that #967 reported a similar exception.

ericleponner avatar Aug 22 '23 14:08 ericleponner

I managed to run my code successfully when my mac is connected to 4G !!!! So I'm not stuck any more :)

However root problem remains: java sdk instability through home box connection looks pretty worrying to me. But feel free to close the issue if your radar is too much busy.

Thanks.

ericleponner avatar Aug 22 '23 16:08 ericleponner

Hey @ericleponner, really glad that you had a breakthrough. Any additional information about your network setup would be helpful. Some basic info would include:

  • MacOS version
  • Any firewalls enabled
  • VPNs or any kind of proxies
  • Any other unusual setups

Also it would be helpful if you can tell me if you have any other problems with connecting to Hedera through the SDK or is it just this script specifically. If there isn't anything strange on the network setup we could possibly try to run a similar example on your machine written on some of the other SDKs, if you are okay with it of course and you have time.

rokn avatar Aug 22 '23 19:08 rokn

MacOS version:

13.5.1

Any firewalls enabled:

I need to investigate. But it's probably a standard setup for home connection box (outgoing enable, incoming disabled)

VPNs or any kind of proxies:

None

Any other unusual setups

I don't think so but I will double check

Also it would be helpful if you can tell me if you have any other problems with connecting to Hedera through the SDK or is it just this script specifically. If there isn't anything strange on the network setup we could possibly try to run a similar example on your machine written on some of the other SDKs, if you are okay with it of course and you have time.

@svienot has similar issues (from another place in France). So I doubt this is specific to my setup in fact.

Keep in mind that:

  • everything worked fine since january
  • around jun / july it started to break
  • home connection setup did not change
  • IntelliJ, JDK and MacOS have been updated

Same for @svienot.

ericleponner avatar Aug 22 '23 20:08 ericleponner

Feel free to reopen it if the issue persists.

thenswan avatar May 30 '24 06:05 thenswan