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

Up to latest #2

Merged
merged 32 commits into from
Oct 7, 2019
Merged

Up to latest #2

merged 32 commits into from
Oct 7, 2019

Conversation

Evengard
Copy link
Owner

@Evengard Evengard commented Oct 7, 2019

No description provided.

JacksonHill and others added 30 commits August 21, 2018 12:00
If host:port is specified in logto parameter instead of a file, the destination log receiver(fluentd -> elasticsearch in my case) is flooded with messages:
uwsgi_check_logrotate()/lseek(): Illegal seek [core/logging.c line 494] 

This commit disables log file related checks if log file descriptor is a socket.
uClibc-ng by default does not compile in execinfo support.
core/uwsgi: Fix compilation with uClibc-ng
- trusty is EOL and the default is going to change to xenial anyways.
  See: https://blog.travis-ci.com/2019-04-15-xenial-default-build-environment

- PPA "ppa:ondrej/php" does not support EOL Ubuntu (trusty) and PHP packages
  are not found anymore.

  See: https://launchpad.net/~ondrej/+archive/ubuntu/php

- update to jdk-8 instead of using outdated PPA "ppa:openjdk-r/ppa"

  Last release was in 2016,
  See: https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa?field.series_filter=xenial
fix travis - build on xenial rather than trusty
Otherwise in case there's no ul->data we segfault.

Fix #2010
Disable logrotate when logging into UDP socket
As I don't want to go grazy with ifdefery in check/Makefile.
Fixup checks and add unittests for uwsgi_opt_set_int
This should not change the existing behavior of using 0 when
a non-numeric value is provided, but loudly logs:

    $ uwsgi test.ini --processes 2x
    [uWSGI] getting INI configuration from test.ini
    [WARNING] non-numeric value "2x" for option "processes" - using 2 !
    [WARNING] non-numeric value "true" for option "http-keepalive" - using 0 !
    *** Starting uWSGI 2.1-dev-ade7d170 (64bit) on [Sun Jun 23 18:36:29 2019] ***
    compiled with version: 8.3.0 on 23 June 2019 16:22:05
    ...

It might be saner to not even start with invalid options. However,
hypothetical setups with http-keepalive=off or http-keepalive=false may
then fail to start at all and people might get unahppy.
uwsgi_opt_set_int: use strtol() and warn on non-numeric data
So at least we can avoid an hack in uwsgiconfig.py
Solaris defines sun to 1 which results in a compilation error:
./uwsgi.h:1646:22: error: expected identifier or ‘(’ before numeric constant struct sockaddr_un sun;

Fix #1933


PyString_FromString is defined as PyBytes_FromString in uwsgi_python.h

What happens in Python 3 during the population of the opt_dict is that
we first check if a byte object, representing the key is in the dict.
If there is none, we use PyDict_SetItemString to set it. However, as
the docs say, PyDict_SetItemString will convert the key using
PyUnicode_FromString and we actually put a unicode key in the dict[1].
Therefore, when we check the "same" key again, we check again for the
"same" key as bytes object we don't find it and end up overwriting it
instead of doing the list promotion dance.

Attached patch fixes this by using PyDict_SetItem and PyDict_GetItem with
a consistent key type. For Python 3, a unicode object is used as key as
this is the backwards compatible thing to do.

Mini tester:
    import uwsgi
    def application(env, start_response):
        start_response('200 OK', [('Content-Type', 'text/plain')])
        for k, v in uwsgi.opt.items():
            yield "{} {!r} ({})\n".format(k, v, type(v)).encode("utf-8")
        yield "{} {}\n".format(uwsgi.version, type(uwsgi.version)).encode("utf-8")
        yield "{} {}\n".format(uwsgi.hostname, type(uwsgi.hostname)).encode("utf-8")
        yield b"END"

What is a bit rough is that in Python 3 the actual values for uwsgi.opt
entries end-up being all bytes, but that has always been like this...

[1] https://docs.python.org/3.5/c-api/dict.html#c.PyDict_SetItemString
uwsgi: fixup name clash on solaris
The struct crypt_data does not exist with uClibc, so a check must be put in
place to make sure uClibc does not try to use this struct.
plugins/router_basicauth: Fix building with uClibc
For each plugin, allow to run multiple apps instead of just the
hard-coded tests/staticfile.py or examples/config2.ru apps.

This helps to add tiny apps for very basic regression testing. Only
a single request is made to / - the app should return 500 on error,
200 OK in the success case.

NOTE: Anything more complicated would probably justify rewriting the
      whole script in Python.
python: fix object leak in uwsgi.workers()
Fix: bug in checking for log file type in logging.c
python: use consistent key type for opt dict manipulations - fixes #1374
@Evengard Evengard merged commit 89a02b3 into Evengard:master Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.