Skip to content

Commit

Permalink
Fixing possible segfaults in embedded mode
Browse files Browse the repository at this point in the history
  • Loading branch information
idlesign committed Sep 9, 2019
1 parent 537d8ce commit f5a3a49
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions uwsgiconf/contrib/django/uwsgify/toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def spawn(cls, options=None, dir_base=None):
project_name=name_project,
options=options)

mutator.mutate()
mutator.mutate(embedded=embedded)

return mutator

Expand Down Expand Up @@ -238,7 +238,7 @@ def contribute_runtime_dir(self):
except OSError: # simulate exist_ok
pass

def mutate(self):
def mutate(self, embedded=False):
"""Mutates current section."""
section = self.section
project_name = self.project_name
Expand All @@ -247,8 +247,14 @@ def mutate(self):

self.contribute_runtime_dir()

main = section.main_process
main.set_naming_params(prefix='[%s] ' % project_name)
main = section.main_process

# The following should prevent possible segfaults in uwsgi_set_processname()'s memsets
# while embedded.
if embedded:
main.set_naming_params(autonaming=False)
else:
main.set_naming_params(prefix='[%s] ' % project_name)

main.set_pid_file(
self.get_pid_filepath(),
Expand Down

0 comments on commit f5a3a49

Please sign in to comment.