title: Why my pub sub message acknowledged? -> Data loss
body: <p>I have a cloud function which is called Pub/Sub. It should ACK the message only when it has been correctly processed.</p>
  <p>I see in my logs a memory failure, then a message 'Finished with status: ok'.
  <a href="https://i.stack.imgur.com/7umQ9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7umQ9.png" alt="Google Cloud Logs" /></a></p>
  <p>And the message is acknowledged and removed from my Pub / Sub topic!</p>
  <p>Reproducer:</p>
  <pre class="lang-py prettyprint-override"><code>import base64
  import requests
  
  def hello_pubsub(event, context):
      &quot;&quot;&quot; Triggered from a message on a Cloud Pub/Sub topic.
          Args:
           event (dict): Event payload.
           context (google.cloud.functions.Context): Metadata for the event.
      &quot;&quot;&quot;
      pubsub_message = base64.b64decode(event['data']).decode('utf-8')
      # let's say that important stuff is done at the line below 
      # which should be retried in case of failure
      r = requests.get('https://zoom.us/client/latest/zoomusInstallerFull.pkg')
      print(pubsub_message)
  </code></pre>