1

I have a python program using POST request to consume API, writen in PHP and running on an Apache2 server (in local for the moment).

I try several times and I have no problem, but after some tries and retries I have the following error :

[Tue Apr 09 16:39:47.969216 2019] [php7:notice] [pid 17215] [client 127.0.0.1:47164] PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 139624576 bytes) in Unknown on line 0 [Tue Apr 09 16:39:48.760054 2019] [core:notice] [pid 1951] AH00051: child pid 17215 exit signal Segmentation fault (11), possible coredump in /etc/apache2

I try to search some clues but I didn't find anything, and I don't understand the problem because I didn't touch the code between the multiple tries.

EDIT : If I try again, the value of Tried to allocate XXXX bytes increase each time

EDIT : In Python here is the line where I have an error requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) :

data = {
    'encodedFile'   : base64.b64encode(fileContent),
    'priority'      : Config.cfg['OCForMaarch']['priority'],
    'status'        : Config.cfg['OCForMaarch']['status'],
    'type_id'       : Config.cfg['OCForMaarch']['type_id'],
    'format'        : Config.cfg['OCForMaarch']['format'],
    'category_id'   : Config.cfg['OCForMaarch']['category_id'],
    'subject'       : subject,
    'destination'   : destination,
    'address_id'    : contact['id'],
    'exp_contact_id': contact['contact_id'],
    'doc_date'      : date
}

res = requests.post(self.baseUrl + 'resources', auth=self.auth, data=data)

Thanks for the help

Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268
Nathan Cheval
  • 773
  • 2
  • 7
  • 32
  • I don't see any code, either in `python` or`php`. Please update your question with the relevant code. – Pedro Lobito Apr 09 '19 at 15:00
  • I added a piece of Python code, where the error is thrown. The PHP code is, for me, irrelevant to be here cause I have the feelling that it's not reach by the Python request – Nathan Cheval Apr 09 '19 at 15:08
  • I don't see how the php code can be irrelevant since it will parse the python's request. This error normally happens when php lacks memory- https://www.groovypost.com/howto/howto/how-to-solve-php-fatal-error-allowed-memory-size-of-8388608-bytes-exhausted/ – Pedro Lobito Apr 09 '19 at 15:18
  • Possible duplicate of [Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted (CodeIgniter + XML-RPC)](https://stackoverflow.com/questions/561066/fatal-error-allowed-memory-size-of-134217728-bytes-exhausted-codeigniter-xml) – Pedro Lobito Apr 09 '19 at 15:23

0 Answers0