Skip to content

Commit

Permalink
Merge branch 'openstreetmap:master' into GitHubActions
Browse files Browse the repository at this point in the history
  • Loading branch information
hummeltech authored Dec 6, 2023
2 parents 1c2327a + 7f68507 commit aa6b358
Show file tree
Hide file tree
Showing 55 changed files with 917 additions and 323 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ install: build
install -m 644 ${INSTALLOPTS} etc/renderer/mapserver/fonts.lst $(DESTDIR)/etc/tirex/renderer/mapserver/fonts.lst
install -m 755 ${INSTALLOPTS} -d $(DESTDIR)/etc/tirex/renderer/mapnik
install -m 644 ${INSTALLOPTS} etc/renderer/mapnik.conf.dist $(DESTDIR)/etc/tirex/renderer/mapnik.conf
install -m 755 ${INSTALLOPTS} -d $(DESTDIR)/etc/logrotate.d
install -m 644 ${INSTALLOPTS} etc/logrotate.d/tirex-master $(DESTDIR)/etc/logrotate.d/tirex-master
install -m 755 ${INSTALLOPTS} -d $(DESTDIR)/usr/share/man/man1/
for program in bin/*; do \
if grep -q "=head" $$program; then \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ installed. Call
to create the packages. The following packages will be created in the parent
directory:

tirex-core
tirex
tirex-backend-mapnik
tirex-backend-wms
tirex-backend-mapserver
Expand Down
11 changes: 9 additions & 2 deletions backend-mapnik/metatilehandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <mapnik/agg_renderer.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/load_map.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/geometry/box2d.hpp>

#if MAPNIK_VERSION >= 300000
# include <mapnik/datasource.hpp>
Expand Down Expand Up @@ -218,7 +218,15 @@ const NetworkResponse *MetatileHandler::handleRequest(const NetworkRequest *requ
}

outfile.close();
free(offsets);
delete rrs;

if (outfile.fail())
{
unlink(tmpfilename);
return NetworkResponse::makeErrorResponse(request, "cannot write metatile");
}

rename(tmpfilename, metafilename);
debug("created %s", metafilename);

Expand All @@ -233,7 +241,6 @@ const NetworkResponse *MetatileHandler::handleRequest(const NetworkRequest *requ
char buffer[20];
snprintf(buffer, 20, "%ld", (end.tv_sec-start.tv_sec) * 1000 + (end.tv_usec - start.tv_usec) / 1000);
resp->setParam("render_time", buffer);
free(offsets);
}
debug("<< MetatileHandler::handleRequest");
return resp;
Expand Down
2 changes: 1 addition & 1 deletion backend-mapnik/networklistener.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void NetworkListener::run()
if (mMaxRequests > -1 && ++mRequestCount > mMaxRequests)
{
error("maxrequests reached, terminating");
exit(1);
break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion backend-mapnik/renderd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,6 @@ int main(int argc, char **argv)
{
RenderDaemon mtd(argc, argv);
mtd.run();
exit(9); // return with EXIT_CODE_RESTART==9 which means everything is ok, the backend can be restartet if the backend-manager wants to
exit(9); // return with EXIT_CODE_RESTART==9 which means everything is ok, the backend can be restarted if the backend-manager wants to
}

72 changes: 33 additions & 39 deletions bin/tirex-backend-manager
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,17 @@ my $TERM_TIMEOUT = 5;
# timeout when waiting for alive messages from workers
my $SELECT_TIMEOUT = 10;

# hash that catalogues worker processes
my $workers;

#-----------------------------------------------------------------------------
# Main loop
#-----------------------------------------------------------------------------
{
my $sockets = {};
while (1)
{
my $workers = {};
$workers = {};

Tirex::Renderer->read_config_dir($config_dir);
syslog('info', 'Found config for renderers: %s', join(' ', map { $_->get_name(); } Tirex::Renderer->all()));
Expand All @@ -160,22 +163,15 @@ my $SELECT_TIMEOUT = 10;

while (! $received_sighup)
{
start_workers($workers, $sockets);
check_for_alive_messages($workers);
cleanup_dead_workers($workers);
kill_old_workers($workers);
start_workers($sockets);
check_for_alive_messages();
cleanup_dead_workers();
kill_old_workers();

if ($received_sigterm)
{
syslog('info', 'TERM/INT received, forwarding to children: %s', join(' ', keys %$workers));

foreach my $pid (keys %$workers)
{
kill('HUP', $pid);
}

unlink($pidfile); # ignore return code
exit(0);
exit_gracefully(0);
}

sleep 1;
Expand All @@ -192,6 +188,19 @@ my $SELECT_TIMEOUT = 10;
}
}

#-----------------------------------------------------------------------------
# Terminate and also kill all children.
#-----------------------------------------------------------------------------
sub exit_gracefully
{
my $exitcode = shift;
foreach my $pid (keys %$workers)
{
kill('HUP', $pid);
}
unlink($pidfile); # ignore return code
exit($exitcode);
}

#-----------------------------------------------------------------------------
# Open sockets for all renderers or re-use old ones after a SIGHUP
Expand Down Expand Up @@ -251,7 +260,6 @@ sub open_sockets
#-----------------------------------------------------------------------------
sub start_workers
{
my $workers = shift;
my $sockets = shift;

foreach my $renderer (Tirex::Renderer->enabled())
Expand Down Expand Up @@ -327,8 +335,6 @@ sub create_pipe
#-----------------------------------------------------------------------------
sub check_for_alive_messages
{
my $workers = shift;

my $select = IO::Select->new();
foreach my $worker (values %$workers)
{
Expand All @@ -353,33 +359,24 @@ sub check_for_alive_messages
#-----------------------------------------------------------------------------
sub cleanup_dead_workers
{
my $workers = shift;

while ((my $pid = waitpid(-1, WNOHANG)) > 0)
{
my $exit_code = $? >> 8;
my $signal = $? & 127;
syslog('warning', 'child %d terminated (exit_code=%d, signal=%d)', $pid, $exit_code, $signal);

# this will happen if a worker child dies which we don't know about
# because we got a SIGHUP in between
next unless ($workers->{$pid});

# if the return code of the child is something other than $EXIT_CODE_RESTART, the renderer is disabled
my $exit_code = $? >> 8;
my $signal = $? & 127;
syslog('warning', 'child %d terminated (exit_code=%d, signal=%d)', $pid, $exit_code, $signal);

# if the return code of the child is something other than $EXIT_CODE_RESTART, we quit.
# this does not happen if the worker child was killed because of a timeout
#if ($exit_code != $Tirex::EXIT_CODE_RESTART && ! defined $workers->{$pid}->{'hungup'})
#{
# my $renderer = $workers->{$pid}->{'renderer'};
# if ($renderer->get_debug())
# {
# syslog('debug', 'renderer %s not disabled because we are in debug mode', $renderer->get_name());
# }
# else
# {
# $renderer->disable();
# syslog('err', 'disabled renderer %s', $renderer->get_name());
# }
#}
if ($exit_code != $Tirex::EXIT_CODE_RESTART && ! defined $workers->{$pid}->{'hungup'})
{
my $renderer = $workers->{$pid}->{'renderer'};
syslog('err', 'terminating due to unexpected error in renderer %s', $renderer->get_name());
exit_gracefully(2);
}

$workers->{$pid}->{'handle'}->close();
$workers->{$pid}->{'renderer'}->remove_worker($pid);
Expand All @@ -393,8 +390,6 @@ sub cleanup_dead_workers
#-----------------------------------------------------------------------------
sub kill_old_workers
{
my $workers = shift;

my $now = time();

foreach my $worker (values %$workers)
Expand Down Expand Up @@ -467,7 +462,6 @@ sub sigterm_handler
$received_sigterm = 1;
}


__END__
=head1 NAME
Expand Down
14 changes: 9 additions & 5 deletions bin/tirex-status
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,22 @@ sub format_status
my @styles = keys %{$d->{'rm'}->{'stats'}->{'sum_render_time'}};
my $maxzoom = 0;
map { $maxzoom = max($maxzoom, scalar(@{$d->{'rm'}->{'stats'}->{'sum_render_time'}->{$_}})); } @styles;
$r = "style zoom |";
my $max_name_len = 0;
map { $max_name_len = max($max_name_len, length($_)); } @styles;

$r = "style" . " " x ($max_name_len-9) . "zoom |";
for (my $i = 0; $i < $maxzoom; $i++)
{
$r .= sprintf("%7d ", $i);
}
$r .= "\n";
$r .= "---------------+";
$r .= "----------" x $maxzoom;
$r .= "-" x $max_name_len;
$r .= "-+";
$r .= "--------" x $maxzoom;
$r .= "\n";
foreach (@styles)
foreach (sort @styles)
{
$r .= sprintf("%-15s|", $_);
$r .= sprintf("%-${max_name_len}s |", $_);
for (my $i = 0; $i < $maxzoom; $i++)
{
my $time = $d->{'rm'}->{'stats'}->{'sum_render_time'}->{$_}->[$i];
Expand Down
135 changes: 28 additions & 107 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,116 +1,37 @@
tirex (0.6.4) focal; urgency=medium

* allow adding a dot and zoom level after mapfile parameter to override map file for specific zoom levels

-- Frederik Ramm <[email protected]> Fri, 13 Aug 2021 11:55:10 +0200

tirex (0.6.3) bionic; urgency=medium

* modify TMS backend to take template URL parameter

-- Frederik Ramm <[email protected]> Mon, 29 Jun 2020 15:57:07 +0200

tirex (0.6.2) bionic; urgency=medium
tirex (0.8.0-pre) unstable; urgency=medium

* add TMS backend

-- Frederik Ramm <[email protected]> Wed, 21 Aug 2019 16:10:48 +0200

tirex (0.6.1) bionic; urgency=medium

* add openseamap backend

-- Frederik Ramm <[email protected]> Wed, 21 Aug 2019 16:10:48 +0200

tirex (0.6.0) bionic; urgency=medium

* tirex-syncd to use ssh master, also allow multiple destinations

-- Frederik Ramm <[email protected]> Sat, 02 Mar 2019 14:23:23 +0000

tirex (0.5.2) bionic; urgency=medium

* die after serving X requests

-- Frederik Ramm <[email protected]> Mon, 14 Dec 2015 20:06:23 +0000

tirex (0.5.1) bionic; urgency=medium

* jpeg tiles
* mapnik 3

-- Frederik Ramm <[email protected]> Mon, 14 Dec 2015 20:06:23 +0000

tirex (0.4.1precise1) precise; urgency=low

* support (alomst) arbitrary sized meta tiles
* support for Mapnik2

-- Frederik Ramm <[email protected]> Tue, 26 Jun 2012 21:45:22 +0000

tirex (0.3.1debian1) precise; urgency=low

* fix epsg3857 bug

-- Frederik Ramm <[email protected]> Tue, 08 May 2012 20:27:04 +0000

tirex (0.3.0) jaunty; urgency=low

* add mapserver backend

-- Sven Geggus <[email protected]> Fri, 03 Feb 2012 19:43:24 +0100

tirex (0.2.0) jaunty; urgency=low

* new renderd architecture allows several different renderers at the same time
* lots of other small improvements

-- Frederik Ramm <[email protected]> Mon, 3 May 2010 10:30:44 +0100

tirex (0.1.7) jaunty; urgency=low

* bugfixes on zoom level 1+2

-- Frederik Ramm <[email protected]> Mon, 15 Mar 2010 21:48:44 +0100

tirex (0.1.6) jaunty; urgency=low

* munin plugin overhaul

-- Frederik Ramm <[email protected]> Fri, 26 Feb 2010 22:38:03 +0100

tirex (0.1.5) jaunty; urgency=low

* new commands to stop/continue buckets

-- Frederik Ramm <[email protected]> Wed, 24 Feb 2010 15:03:40 +0100

tirex (0.1.4) jaunty; urgency=low

* new features+utilities, manpages

-- Frederik Ramm <[email protected]> Thu, 18 Feb 2010 12:02:16 +0100

tirex (0.1.3) jaunty; urgency=low

* lots of new features

-- Frederik Ramm <[email protected]> Mon, 15 Feb 2010 19:17:53 +0100

tirex (0.1.2) jaunty; urgency=low
* preliminary build for github HEAD

* fixed renderd starter dying
-- Frederik Ramm <[email protected]> Thu, 19 May 2022 13:41:14 +0200

-- Frederik Ramm <[email protected]> Wed, 10 Feb 2010 17:15:52 +0100
tirex (0.7.0-1) unstable; urgency=medium

tirex (0.1.1) jaunty; urgency=low
* Move from experimental to unstable.

* new build
-- Felix Delattre <[email protected]> Mon, 22 Nov 2021 16:56:21 +0000

-- Frederik Ramm <[email protected]> Wed, 10 Feb 2010 11:40:21 +0100
tirex (0.7.0-1~exp1) experimental; urgency=medium

tirex (0.1) unstable; urgency=low
[ Felix Delattre ]
* Initial package (Closes: #968676).
* New upstream release 0.7.0
* Adjusted copyright information.
* Use tirex package.
* Sort and review dependencies.
* Review section declaration of packages.
* Place apache2 config when installing tirex.
* Introduce dedicated user _tirex.
* Remove experimental backends, plugins, and example map from packaging.
* Load utils into /usr/share.
* Handle tiles and stats in cache directory.
* Use daemon under /run.
* Check on systemd service files.
* Revisit configuration.
* Bump Standards-Version to 4.6.0, no changes.

* Initial release.
[ Bas Couwenberg ]
* Bump watch file version to 4.
* Bump Standards-Version to 4.5.1, no changes.
* Update watch file for GitHub URL changes.

-- Frederik Ramm <[email protected]> Thu, 04 Feb 2010 00:57:52 +0100
-- Felix Delattre <[email protected]> Thu, 07 Oct 2021 14:37:41 +0000
1 change: 0 additions & 1 deletion debian/compat

This file was deleted.

Loading

0 comments on commit aa6b358

Please sign in to comment.