How do I resolve the errors "session '0' not found" and "Error sending http request and maximum retry encountered" in Amazon EMR?

Last updated: 2019-09-24

I get one of the following errors when I run an Apache Livy application using a Jupyter Notebook on Amazon EMR:

  • '404' from xxxxxxxx with error payload: "session '0' not found"
  • "The code failed because of a fatal error: Error sending http request and maximum retry encountered."

Short Description

These errors usually happen when you leave the Jupyter Notebook session running until it times out. To resolve these errors, increase the value of the livy.server.session.timeout property in /etc/livy/conf/livy.conf on the master node. Then, restart livy-server.

Resolution

You can modify livy.server.session.timeout on a running Amazon EMR cluster or when launching a new cluster.

On a running cluster

1. Open /etc/livy/conf/livy.conf on the master node, and then modify the livy.server.session.timeout value (the default value is 1h). Example:

sudo vim /etc/livy/conf/livy.conf
livy.server.session.timeout 2h

2.    Run the following commands on the master node to restart livy-server:

sudo stop livy-server
sudo start livy-server

Your cluster is unavailable while livy-server restarts. To avoid downtime, configure the Livy application when you launch an Amazon EMR cluster.

On a new cluster

Add a configuration object similar to the following when you launch a cluster using Amazon EMR release version 4.6.0 or later. In addition to modifying livy.server.session.timeout, you can also modify the following related properties, if desired:

  • livy.server.session.timeout-check: when enabled, Livy stops idle sessions that reach the timeout threshold. The default setting is true.
  • livy.server.yarn.app-lookup-timeout: how long Livy looks for the YARN application before considering it lost. The default setting is 60s.
[
    {
        "Classification": "livy-conf",
        "Properties": {
            "livy.server.session.timeout-check": "true",
            "livy.server.session.timeout": "2h",
            "livy.server.yarn.app-lookup-timeout": "120s"
        }
    }
]

Be sure to close the session in Jupyter or Zeppelin when you're done running the job. When too many sessions are open, new jobs can't start until resources become available.


Did this article help you?

Anything we could improve?


Need more help?