Skip to content

Commit

Permalink
Update on error scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ekremsekerci committed Feb 4, 2025
1 parent e1e496e commit b1c20dd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
22 changes: 21 additions & 1 deletion buildpack/core/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,14 +630,34 @@ def _pre_process_m2ee_yaml():
f"s|BUILD_PATH|{os.getcwd()}|g; "
f"s|RUNTIME_PORT|{util.get_runtime_port()}|; "
f"s|ADMIN_PORT|{util.get_admin_port()}|; "
f"s|PYTHONPID|{os.getpid()}|", # TODO Replace in new scripts
".local/m2ee.yaml",
]
)


def _pre_process_on_error_scripts():
logging.debug("Preprocessing on error scripts...")
subprocess.check_call(
[
"sed",
"-i",
f"s|PYTHONPID|{os.getpid()}|",
".local/scripts/on_error.sh",
]
)
subprocess.check_call(
[
"sed",
"-i",
f"s|PYTHONPID|{os.getpid()}|",
".local/scripts/on_out_of_memory_error.sh",
]
)


def setup(vcap_data):
_pre_process_m2ee_yaml()
_pre_process_on_error_scripts()
_activate_license()

client = m2ee_class(
Expand Down
1 change: 0 additions & 1 deletion etc/m2ee/m2ee.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ m2ee:
"-XX:OnError=/home/vcap/app/.local/scripts/on_error.sh",
"-XX:OnOutOfMemoryError=/home/vcap/app/.local/scripts/on_out_of_memory_error.sh",
]
# TODO Replace with BUILD_PATH

jetty:
max_form_content_size: 10485760
Expand Down
3 changes: 1 addition & 2 deletions etc/scripts/on_error.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
echo "### THIS IS ON ERROR SCRIPT ###"
# TODO Write actual signal command
kill -s USR1 PYTHONPID
3 changes: 1 addition & 2 deletions etc/scripts/on_out_of_memory_error.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
echo "### THIS IS ON OOM SCRIPT ###"
# TODO Write actual signal command
kill -s USR2 PYTHONPID

0 comments on commit b1c20dd

Please # to comment.