Description

Application has cored during the initialisation of python API.

failure is due memory allocation i.e malloc, this is clear sign of in-sufficient memory during run-time.


When commit operation is issued it get expanded during run-time and the default memory size is set is not enough to accommodate the config commit from commit script perspective. which resulted the application to core.


Symptoms



BT

(gdb) f 1

#1 0xc93473c1 in PyString_FromString (str=<optimized out>) at ../../../../../../src/dist/python/Objects/stringobject.c:143

143    op = (PyStringObject *)PyObject_MALLOC(PyStringObject_SIZE + size);

(gdb) bt

#0 PyObject_Malloc (nbytes=24) at ../../../../../../src/dist/python/Objects/obmalloc.c:829 >>>>>>>>>>>>>>>>>>> malloc failure

#1 0xc93473c1 in PyString_FromString (str=<optimized out>) at ../../../../../../src/dist/python/Objects/stringobject.c:143

#2 0xc92cfbaa in PyDict_GetItemString (v=<optimized out>, key=0xc924745d "jcs") at ../../../../../../src/dist/python/Objects/dictobject.c:2506

#3 0xc92e1fd4 in PyImport_AddModule (name=<optimized out>) at ../../../../../../src/dist/python/Python/import.c:637

#4 0xc92dfab3 in Py_InitModule4 (name=0xc924745d "jcs", methods=0x0, doc=0x18 <error: Cannot access memory at address 0x18>, passthrough=<optimized out>, module_api_version=<optimized out>) at ../../../../../../src/dist/python/Python/modsupport.c:65

#5 0xc9231e79 in init_python_ext_modules () at ../../../../../../../src/ui/usr.sbin/cscript/pythonjcs.c:1426

#6 Initialize_python () at ../../../../../../../src/ui/usr.sbin/cscript/pythonjcs.c:1590

Solution

We have a config knob which provide provision to increase the memory size for commit script.

>>>>> [edit system scripts commit max-datasize <value>]


these knob needs to be configured as pre-requisite before any operation are performed from commit script perspective.

  

FYR:

https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/statement/max-datasize-edit-system-scripts.html


Modification History

2025-03-18 : Article Created

Related Information

2025-0128-379837