title: Once in a while, axios http long polling not returning at all
body: <p>I have a function that looks like</p>
  <pre class="lang-js prettyprint-override"><code>async function longPoll() {
      let timeout = 0
      try {
          // perform longPoll tasks
          let response = await axios.get(config.url)
          const data = response.data &amp;&amp; response.data.data
          if (!Array.isArray(data)) {
              return
          }
          await Promise.all(data.map(async(item) =&gt; {
              try {
                  // send message via WhatsApp using 'whatsapp-web.js'
                  let chatId = getChatId(item)
                  let text = getText(item)
                  await client.sendMessage(chatId, text)
              } catch (e) {
                  // some logging
                  return
              }
              try {
                  // report sending is ok
                  let response = await axios.get(config.confirmationUrl)
              } catch (e) {
                  // some logging
              }
          }))
      } catch (e) {
          if (e.response) {
              let status = e.response.status
              let statusText = e.response.statusText
              console.error(`Server response ${status} ${statusText}`)
          } else if (e.request) {
              console.error('No response from server.')
          } else {
              console.error('Failed to create request.')
          }
          timeout = 5000
      } finally {
          setTimeout(longPoll, timeout)
      }
  }
  
  longPoll() // kick off
  </code></pre>
  <p>In the beginning, it runs fine. After a while, <code>longPoll()</code> is no longer called. Why is it so?</p>
  <p>I'm using NodeJS v16.14.0 with axios v0.19</p>
  <hr />
  <p><strong>Notes:</strong></p>
  <ol>
  <li>I have found the cause. See <a href="https://stackoverflow.com/a/72825367/109747">my own answer</a>.</li>
  <li>Repro steps available in <a href="https://stackoverflow.com/questions/71326030/once-in-a-while-axios-http-long-polling-not-returning-at-all#comment128634162_71326030">my comment</a></li>
  <li>I <a href="https://stackoverflow.com/questions/71326030/once-in-a-while-axios-http-long-polling-not-returning-at-all#comment128630862_71326030">undeleted this question</a> for informational &amp; sharing purpose</li>
  </ol>