Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tirex-Backend-Manager should fail to start if a mapnik style cannot be loaded. #70

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion backend-mapnik/renderd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ RenderDaemon::RenderDaemon(int argc, char **argv) :
char *tkn = strtok(dup, " ");
while (tkn)
{
loadMapnikWrapper(tkn);
if (!loadMapnikWrapper(tkn)) {
warning("Unable to load map");
exit(2);
}
tkn = strtok(NULL, " ");
}
}
Expand Down
4 changes: 2 additions & 2 deletions bin/tirex-backend-manager
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ die("refusing to run as root\n") if ($< == 0);
my @argv = @ARGV;

my %opts = ();
GetOptions( \%opts, 'help|h', 'debug|d', 'foreground|f', 'config|c=s' ) or exit(2);
GetOptions( \%opts, 'help|h', 'debug|d', 'foreground|f', 'config|c=s' ) or exit($Tirex::EXIT_CODE_INVALIDARGUMENT);

if ($opts{'help'})
{
Expand Down Expand Up @@ -375,7 +375,7 @@ sub cleanup_dead_workers
{
my $renderer = $workers->{$pid}->{'renderer'};
syslog('err', 'terminating due to unexpected error in renderer %s', $renderer->get_name());
exit_gracefully(2);
exit_gracefully($Tirex::EXIT_CODE_INVALIDARGUMENT);
}

$workers->{$pid}->{'handle'}->close();
Expand Down
1 change: 1 addition & 0 deletions debian/tirex-backend-manager.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ExecStart=/usr/bin/tirex-backend-manager -f
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=INVALIDARGUMENT
User=_tirex
Group=_tirex

Expand Down
1 change: 1 addition & 0 deletions lib/Tirex.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ our $MAX_PACKET_SIZE = 512;
# max zoom level we will ever allow
our $MAX_ZOOM = 30;

our $EXIT_CODE_INVALIDARGUMENT = 2;
our $EXIT_CODE_RESTART = 9;
our $EXIT_CODE_DISABLE = 10;

Expand Down