The Question
How do I best execute memory-intensive pipelines in Apache Beam?
Background
I've written a pipeline that takes the Naemura Bird dataset and converts the images and annotations to TF Records with TF Examples of the required format for the TF object detection API.
I tested the pipeline using DirectRunner with a small subset of images (4 or 5) and it worked fine.
The Problem
When running the pipeline with a bigger data set (day 1 of 3, ~21GB) it crashes after a while with a non-descriptive SIGKILL.
I do see a memory peak before the crash and assume that the process is killed because of a too high memory load.
I ran the pipeline through strace. These are the last lines in the trace:
[pid 53702] 10:00:09.105069 poll([{fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}, {fd=14, events=POLLIN}, {fd=15, events=POLLIN}, {fd=16, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=19, events=POLLIN}, {fd=20, events=POLLIN}], 11, 100) = 0 (Timeout)
[pid 53702] 10:00:09.205826 poll([{fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}, {fd=14, events=POLLIN}, {fd=15, events=POLLIN}, {fd=16, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=19, events=POLLIN}, {fd=20, events=POLLIN}], 11, 100 <unfinished ...>
[pid 53534] 10:00:09.259806 mmap(NULL, 63082496, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3aa43d7000
[pid 53694] 10:00:09.297140 <... clock_nanosleep resumed>NULL) = 0
[pid 53694] 10:00:09.297273 clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=200000000}, <unfinished ...>
[pid 53702] 10:00:09.306409 <... poll resumed>) = 0 (Timeout)
[pid 53702] 10:00:09.306478 poll([{fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}, {fd=14, events=POLLIN}, {fd=15, events=POLLIN}, {fd=16, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=19, events=POLLIN}, {fd=20, events=POLLIN}], 11, 100) = 0 (Timeout)
[pid 53702] 10:00:09.406866 poll([{fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}, {fd=14, events=POLLIN}, {fd=15, events=POLLIN}, {fd=16, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=19, events=POLLIN}, {fd=20, events=POLLIN}], 11, 100 <unfinished ...>
[pid 53710] 10:03:55.844910 <... futex resumed>) = ?
[pid 53709] 10:03:57.797618 <... futex resumed>) = ?
[pid 53708] 10:03:57.797737 <... futex resumed>) = ?
[pid 53707] 10:03:57.797793 <... futex resumed>) = ?
[pid 53706] 10:03:57.797847 <... futex resumed>) = ?
[pid 53705] 10:03:57.797896 <... futex resumed>) = ?
[pid 53704] 10:03:57.797983 <... futex resumed>) = ?
[pid 53703] 10:03:57.798035 <... futex resumed>) = ?
[pid 53702] 10:03:57.798085 +++ killed by SIGKILL +++
[pid 53701] 10:03:57.798124 <... futex resumed>) = ?
[pid 53700] 10:03:57.798173 <... futex resumed>) = ?
[pid 53699] 10:03:57.798224 <... futex resumed>) = ?
[pid 53698] 10:03:57.798272 <... futex resumed>) = ?
[pid 53697] 10:03:57.798321 <... accept4 resumed> <unfinished ...>) = ?
[pid 53694] 10:03:57.798372 <... clock_nanosleep resumed> <unfinished ...>) = ?
[pid 53693] 10:03:57.798426 <... futex resumed>) = ?
[pid 53660] 10:03:57.798475 <... futex resumed>) = ?
[pid 53641] 10:03:57.798523 <... futex resumed>) = ?
[pid 53640] 10:03:57.798572 <... futex resumed>) = ?
[pid 53639] 10:03:57.798620 <... futex resumed>) = ?
[pid 53710] 10:03:57.798755 +++ killed by SIGKILL +++
[pid 53709] 10:03:57.798792 +++ killed by SIGKILL +++
[pid 53708] 10:03:57.798828 +++ killed by SIGKILL +++
[pid 53707] 10:03:57.798864 +++ killed by SIGKILL +++
[pid 53706] 10:03:57.798900 +++ killed by SIGKILL +++
[pid 53705] 10:03:57.798937 +++ killed by SIGKILL +++
[pid 53704] 10:03:57.798973 +++ killed by SIGKILL +++
[pid 53703] 10:03:57.799008 +++ killed by SIGKILL +++
[pid 53701] 10:03:57.799044 +++ killed by SIGKILL +++
[pid 53700] 10:03:57.799079 +++ killed by SIGKILL +++
[pid 53699] 10:03:57.799116 +++ killed by SIGKILL +++
[pid 53698] 10:03:57.799152 +++ killed by SIGKILL +++
[pid 53697] 10:03:57.799187 +++ killed by SIGKILL +++
[pid 53694] 10:03:57.799245 +++ killed by SIGKILL +++
[pid 53693] 10:03:57.799282 +++ killed by SIGKILL +++
[pid 53660] 10:03:57.799318 +++ killed by SIGKILL +++
[pid 53641] 10:03:57.799354 +++ killed by SIGKILL +++
[pid 53640] 10:03:57.799390 +++ killed by SIGKILL +++
[pid 53639] 10:03:57.910349 +++ killed by SIGKILL +++
10:03:57.910381 +++ killed by SIGKILL +++
Multiple things could cause this behaviour, because the pipeline runs fine with less Data, analysing what has changed could lead us to a resolution.
Option 1 : clean your input data
The third line of the logs you provide might indicate that you're processing unclean data in your bigger pipeline mmap(NULL, could mean that | "Get Content" >> beam.Map(lambda x: x.read_utf8()) is trying to read a null value.
Is there an empty file somewhere ? Are your files utf8 encoded ?
Option 2 : use smaller files as input
I'm guessing using the fileio.ReadMatches() will try to load into memory the whole file, if your file is bigger than your memory, this could lead to errors. Can you split your data into smaller files ?
Option 3 : use a bigger infrastructure
If files are too big for your current machine with a DirectRunner you could try to use an on-demand infrastructure using another runner on the Cloud such as DataflowRunner
Related
My application is based on Micronaut and GraalVM (java 11) and does a simple call to http://httpbin.org/get:
#Controller("/api")
class HelloWorld(
#Client("http://httpbin.org")
private val httpClient: RxHttpClient
) {
private val logger = LoggerFactory.getLogger(javaClass)
#Get("/hello")
fun hello(): String {
return "Hello World!"
}
#Get("/fb")
fun fb(): Flowable<String> {
logger.info("Trying to call FB")
logger.info("Using url http://httpbin.org/get")
try {
return httpClient.retrieve("/get")
.doOnError { logger.error("Error calling fb api flowable", it) }
.doFinally { logger.info("Finished calling FB api flowable") }
} catch (ex: Exception) {
logger.error("Error calling fb api", ex)
throw ex
} finally {
logger.info("Finished calling fb api")
}
}
}
When I build a docker image of the app using this Dockerfile:
FROM maven:3.6.3-jdk-11 as maven
COPY . /home/app
WORKDIR /home/app
RUN mvn package
FROM oracle/graalvm-ce:19.3.1-java11 as graalvm
COPY --from=maven /home/app/target/app-*.jar /home/app/
WORKDIR /home/app
RUN gu install native-image
RUN native-image --no-server --enable-http --enable-https -cp app-*.jar
FROM debian:stretch
EXPOSE 8080
COPY --from=graalvm /home/app/app .
#RUN apt-get update && apt-get -y install strace
ENTRYPOINT ["./app"]
Everything works in my local environment.
But when I push the image to Google Cloud Repository, deploy it to Cloud Run and try to access the endpoint /api/fb, it crashes the container with 503 Service Unavailable.
The error in the logs is "The request failed because the HTTP connection to the instance had an error.". When I enable strace, these are the logs:
A 2020-02-07T12:04:27.443115Z [pid 18] <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out)
A 2020-02-07T12:04:27.443125Z [pid 18] futex(0x3e61dc018a80, FUTEX_WAKE_PRIVATE, 1) = 0
A 2020-02-07T12:04:27.443357Z [pid 18] futex(0x3e62040009c4, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x3e6204000990, 234) = 1
A 2020-02-07T12:04:27.443369Z [pid 15] <... futex resumed> ) = 0
A 2020-02-07T12:04:27.443440Z [pid 18] futex(0x3e61dc018ab4, FUTEX_WAIT_BITSET_PRIVATE, 157, {tv_sec=3624, tv_nsec=391761056}, 0xffffffff <unfinished ...>
A 2020-02-07T12:04:27.443478Z [pid 15] futex(0x3e6204000990, FUTEX_WAKE_PRIVATE, 1) = 0
A 2020-02-07T12:04:27.959629Z [pid 20] epoll_wait(17, <unfinished ...>
A 2020-02-07T12:04:27.959658Z [pid 8] <... epoll_wait resumed> [{EPOLLIN, {u32=53, u64=53}}], 1024, -1) = 1
A 2020-02-07T12:04:27.959865Z [pid 8] accept(53, {sa_family=AF_INET6, sin6_port=htons(36294), inet_pton(AF_INET6, "::ffff:169.254.8.129", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, [28]) = 4
A 2020-02-07T12:04:27.959884Z [pid 8] fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
A 2020-02-07T12:04:27.959945Z [pid 8] getsockname(4, {sa_family=AF_INET6, sin6_port=htons(8080), inet_pton(AF_INET6, "::ffff:169.254.8.130", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, [28]) = 0
A 2020-02-07T12:04:27.960036Z [pid 8] getsockname(4, {sa_family=AF_INET6, sin6_port=htons(8080), inet_pton(AF_INET6, "::ffff:169.254.8.130", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, [28]) = 0
A 2020-02-07T12:04:27.960085Z [pid 8] fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
A 2020-02-07T12:04:27.960128Z [pid 8] fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
A 2020-02-07T12:04:27.960211Z [pid 8] setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0
A 2020-02-07T12:04:27.960322Z [pid 8] getsockopt(4, SOL_SOCKET, SO_SNDBUF, [1048576], [4]) = 0
A 2020-02-07T12:04:27.960440Z [pid 8] mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x3e60f0e00000
A 2020-02-07T12:04:27.960564Z [pid 8] mprotect(0x3e60f0e00000, 4096, PROT_NONE) = 0
A 2020-02-07T12:04:27.960793Z [pid 8] clone(/usr/bin/strace: Process 22 attached
A 2020-02-07T12:04:27.960875Z <unfinished ...>
A 2020-02-07T12:04:27.965711Z [pid 22] set_robust_list(0x3e60f16009e0, 24 <unfinished ...>
A 2020-02-07T12:04:27.965738Z [pid 8] <... clone resumed> child_stack=0x3e60f15fffb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x3e60f16009d0, tls=0x3e60f1600700, child_tidptr=0x3e60f16009d0) = 22
A 2020-02-07T12:04:27.965753Z [pid 22] <... set_robust_list resumed> ) = -1 ENOSYS (Function not implemented)
A 2020-02-07T12:04:27.965761Z [pid 8] epoll_wait(29, <unfinished ...>
A 2020-02-07T12:04:27.965770Z [pid 22] sched_getaffinity(22, 32, [0, 1]) = 8
A 2020-02-07T12:04:27.965783Z [pid 22] futex(0x3b4c0c4, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x3b4c068, 30) = 1
A 2020-02-07T12:04:27.965790Z [pid 3] <... futex resumed> ) = 0
A 2020-02-07T12:04:27.965799Z [pid 3] futex(0x3b4c068, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
A 2020-02-07T12:04:27.965807Z [pid 22] futex(0x3b4c068, FUTEX_WAKE_PRIVATE, 1) = 1
A 2020-02-07T12:04:27.965816Z [pid 22] mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 <unfinished ...>
A 2020-02-07T12:04:27.965824Z [pid 3] <... futex resumed> ) = 0
A 2020-02-07T12:04:27.965833Z [pid 3] futex(0x3b4c068, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
A 2020-02-07T12:04:27.965842Z [pid 22] <... mmap resumed> ) = 0x3e60f0c00000
A 2020-02-07T12:04:27.965850Z [pid 3] <... futex resumed> ) = 0
A 2020-02-07T12:04:27.965858Z [pid 3] futex(0x3b4c0c4, FUTEX_WAIT_PRIVATE, 31, NULL <unfinished ...>
A 2020-02-07T12:04:27.965866Z [pid 22] munmap(0x3e60f0d00000, 1048576) = 0
A 2020-02-07T12:04:27.965874Z [pid 22] prctl(PR_SET_NAME, "ntLoopGroup-1-7"...) = 0
A 2020-02-07T12:04:27.965882Z [pid 22] epoll_wait(20, [], 1024, 0) = 0
A 2020-02-07T12:04:27.965891Z [pid 22] mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x3e60f0a00000
A 2020-02-07T12:04:27.965903Z [pid 22] munmap(0x3e60f0b00000, 1048576) = 0
A 2020-02-07T12:04:27.966731Z [pid 22] epoll_ctl(20, EPOLL_CTL_ADD, 4, {EPOLLIN, {u32=4, u64=4}}) = 0
A 2020-02-07T12:04:27.966836Z [pid 22] epoll_wait(20, [{EPOLLIN, {u32=4, u64=4}}], 1024, 299996) = 1
A 2020-02-07T12:04:27.967306Z [pid 22] mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x3e60f0800000
A 2020-02-07T12:04:27.967325Z [pid 22] munmap(0x3e60f0900000, 1048576) = 0
A 2020-02-07T12:04:27.967493Z [pid 22] mmap(NULL, 16781312, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x3e60ef600000
A 2020-02-07T12:04:27.984977Z [pid 22] read(4, "GET /api/fb HTTP/1.1\r\nhost: app"..., 1024) = 864
A 2020-02-07T12:04:27.985474Z [36m12:04:27.985[0;39m [1;30m[nioEventLoopGroup-1-7][0;39m [34mINFO [0;39m [35mcom.roihunter.app.HelloWorld[0;39m - Trying to call FB
A 2020-02-07T12:04:27.985581Z [36m12:04:27.985[0;39m [1;30m[nioEventLoopGroup-1-7][0;39m [34mINFO [0;39m [35mcom.roihunter.app.HelloWorld[0;39m - Using url /act_984750788289990/insights
A 2020-02-07T12:04:27.985645Z [pid 22] write(1, "\33[36m12:04:27.985\33[0;39m \33[1;30m"..., 143) = 143
A 2020-02-07T12:04:27.985666Z [pid 22] write(1, "\33[36m12:04:27.985\33[0;39m \33[1;30m"..., 165) = 165
A 2020-02-07T12:04:27.985766Z [36m12:04:27.985[0;39m [1;30m[nioEventLoopGroup-1-7][0;39m [34mINFO [0;39m [35mcom.roihunter.app.HelloWorld[0;39m - Finished calling fb api
A 2020-02-07T12:04:27.985836Z [pid 22] write(1, "\33[36m12:04:27.985\33[0;39m \33[1;30m"..., 149) = 149
A 2020-02-07T12:04:27.986363Z [pid 22] write(4, "HTTP/1.1 200 OK\r\ntransfer-encodi"..., 143) = 143
E 2020-02-07T12:04:27.988626Z GET 503 546 B 31 ms curl/7.66.0 https://app-5phkf6s3jq-ez.a.run.app/api/fb GET 503 546 B 31 ms curl/7.66.0
A 2020-02-07T12:04:27.989104Z [pid 22] writev(4, [{iov_base="1\r\n", iov_len=3}, {iov_base="[", iov_len=1}, {iov_base="\r\n", iov_len=2}], 3) = 6
A 2020-02-07T12:04:27.989513Z [pid 22] mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x3e60eec00000
A 2020-02-07T12:04:27.989534Z [pid 22] mprotect(0x3e60eec00000, 4096, PROT_NONE) = 0
A 2020-02-07T12:04:27.989732Z [pid 22] clone(/usr/bin/strace: Process 23 attached
A 2020-02-07T12:04:27.989753Z <unfinished ...>
A 2020-02-07T12:04:27.989873Z [pid 23] set_robust_list(0x3e60ef4009e0, 24) = -1 ENOSYS (Function not implemented)
A 2020-02-07T12:04:27.989884Z [pid 23] sched_getaffinity(23, 32, [0, 1]) = 8
A 2020-02-07T12:04:27.989964Z [pid 23] futex(0x3b4c0c4, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x3b4c068, 32) = 1
A 2020-02-07T12:04:27.990286Z [pid 23] mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 <unfinished ...>
A 2020-02-07T12:04:27.990303Z [pid 22] <... clone resumed> child_stack=0x3e60ef3fffb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x3e60ef4009d0, tls=0x3e60ef400700, child_tidptr=0x3e60ef4009d0) = 23
A 2020-02-07T12:04:27.990311Z [pid 23] <... mmap resumed> ) = 0x3e60eea00000
A 2020-02-07T12:04:27.990320Z [pid 3] <... futex resumed> ) = 0
A 2020-02-07T12:04:27.990327Z [pid 3] futex(0x3b4c068, FUTEX_WAKE_PRIVATE, 1) = 0
A 2020-02-07T12:04:27.990335Z [pid 3] futex(0x3b4c0c4, FUTEX_WAIT_PRIVATE, 33, NULL <unfinished ...>
A 2020-02-07T12:04:27.990345Z [pid 23] munmap(0x3e60eeb00000, 1048576) = 0
A 2020-02-07T12:04:27.990423Z [pid 22] socket(AF_INET6, SOCK_STREAM, IPPROTO_IP <unfinished ...>
A 2020-02-07T12:04:27.990435Z [pid 23] prctl(PR_SET_NAME, "ionThreadPool-1"... <unfinished ...>
A 2020-02-07T12:04:27.990446Z [pid 22] <... socket resumed> ) = 80
A 2020-02-07T12:04:27.990668Z [pid 22] setsockopt(80, SOL_IPV6, IPV6_V6ONLY, [0], 4) = 0
A 2020-02-07T12:04:27.990684Z [pid 23] <... prctl resumed> ) = 0
I tried using a different library to make the call, Java 11 Http client, and it works. But whatever I do, it doesn't work when I use Micronaut Http client, and there is no helpful message.
I also tried using Java 8, a different linux distribution in the docker image (fedora:latest, ubuntu:latest), but it didn't help.
Do you have any idea what could be causing this?
Thanks for you answer in advance.
ok. Since this is the only question that comes up whenever someone searches for cloud run 503 error, I would like to share my horrible experience and solution.
I deployed my spring boot app on cloud run and configured pub-sub push subscription trigger for it. I tested it on my local system. Then i tested it on my private GCP project. And then when i deployed it on my organization's GCP account, I started to get 503 error.
After this, below is what i tried.
I tried changing the roles/permissions of the default service account (which was used by the run instance) by giving max permissions, but it was of no use.
Tried changing the concurrency to 1 (as suggested in GCP docs) but no help.
I started comparing each and every config of my run instance with my private GCP run instance, And then i found out that I mistakenly had checked below option which was causing this issue.
So i unchecked it, redeployed my instance, and it worked.
In my case I simply made a syntax error in my python code inside my Cloud Run instance and I got the 503 Service Unavailable error.
This showed up in the logs. Go to your Cloud Run Service and click "Logs" for more details.
So it looks like the core of the issue is that Cloud Run currently does not support HTTP streaming:
https://cloud.google.com/run/docs/issues#grpc_websocket
And when I return Flowable with Micronauts, it is opening a streamable HTTP connection. So the solution is not to use Flowable (or any other Publisher that is unbounded e.g. Flow, Flux etc) as a response.
I have a search component which works like this:
An user performs a search by selecting multiples searches (from 1 to around 25).
When the user submit the search form, the front send one HTTP request to the API per selected search. The frontend is an Angular 8 app and the API is a Java API running in Tomcat 9 behind Apache 2 (with HTTP2 support) acting as a reverse proxy.
If the user submit the search form a second time, each unfinished request is cancel and we go back to the second step.
When the second request is send, an error net::ERR_HTTP2_PROTOCOL_ERROR is sometimes throw, it happens only if at least one HTTP request has been canceled.
I tried to isolate the problem as much as I could. The following program (hosted on a Gitlab repository) reproduce the issue with minimal code: dorianm/apache2-http2-chrome-error
It contains a minimal Apache 2 configuration (only 43 rows):
# [...]
DocumentRoot /usr/local/apache2/htdocs/
<Directory "/usr/local/apache2/htdocs/">
Options ExecCGI
AddHandler cgi-script .pl
Require all granted
</Directory>
Protocols h2
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite !EDH:!AECDH:!ADH:!DSS:!RC4:ECDSA:HIGH:+3DES
SSLHonorCipherOrder on
SSLCertificateFile /usr/local/apache2/conf/server.crt
SSLCertificateKeyFile /usr/local/apache2/conf/server.key
# [...]
A simple basic CGI Perl script:
#!/usr/bin/env perl
print "Content-Type: application/json\n\n";
print '[{ … }]'; # ~100kb of random JSON
And a Javascript script which call the CGI script from the frontend/cancel requests/…:
let runningQueries = [];
let intervalId;
const getIntervalTime = () => document.getElementById("intervalTime").value; // 50ms by default
setInterval(() => {
fetch("https://localhost/cgi.pl?constant");
}, 200);
const searches = [];
for (let i = 1; i <= 10; i++) {
searches.push(`https://localhost/cgi.pl?${i}`);
}
function start() {
intervalId = setInterval(() => {
runningQueries.forEach(controller => {
controller.abort();
});
runningQueries = [];
searches.forEach(url => {
const controller = new AbortController();
runningQueries.push(controller);
fetch(url, {signal: controller.signal}).catch(err => {
console.log(err);
});
});
}, getIntervalTime());
}
function stop() {
clearInterval(intervalId);
}
Two buttons are available in front to execute the start and the stop functions. Thanks to that code, I can reproduce my issue:
I export Chrome logs (from chrome://net-export/ tools):
t=5644 [st=194] +HTTP_TRANSACTION_SEND_REQUEST [dt=9]
t=5644 [st=194] HTTP_TRANSACTION_HTTP2_SEND_REQUEST_HEADERS
--> :method: GET
:authority: localhost
:scheme: https
:path: /cgi.pl?constant
authorization: [30 bytes were stripped]
sec-fetch-mode: cors
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
accept: */*
sec-fetch-site: same-origin
referer: https://localhost/index.html
accept-encoding: gzip, deflate, br
accept-language: fr,en;q=0.9,de;q=0.8,it;q=0.7
cookie: [1585 bytes were stripped]
t=5653 [st=203] -HTTP_TRANSACTION_SEND_REQUEST
t=5653 [st=203] +HTTP_TRANSACTION_READ_HEADERS [dt=180]
t=5833 [st=383] HTTP2_STREAM_ERROR
--> description = "Server reset stream."
--> net_error = "ERR_HTTP2_PROTOCOL_ERROR"
--> stream_id = 2945
t=5833 [st=383] -HTTP_TRANSACTION_READ_HEADERS
--> net_error = -337 (ERR_HTTP2_PROTOCOL_ERROR)
t=5833 [st=383] -URL_REQUEST_START_JOB
--> net_error = -337 (ERR_HTTP2_PROTOCOL_ERROR)
t=5833 [st=383] URL_REQUEST_DELEGATE_RESPONSE_STARTED [dt=0]
t=5833 [st=383] -REQUEST_ALIVE
--> net_error = -337 (ERR_HTTP2_PROTOCOL_ERROR)
And I change Apache logs to the trace level. The only interesting part is the following:
[Fri Oct 18 09:59:34.120151 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1839]], frames=1895/2902 (r/s)
[Fri Oct 18 09:59:34.120168 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1841]], frames=1895/2903 (r/s)
[Fri Oct 18 09:59:34.120186 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1843]], frames=1895/2904 (r/s)
[Fri Oct 18 09:59:34.120194 2019] [authz_core:debug] [pid 10:tid 139650130171648] mod_authz_core.c(820): [client 192.168.192.1:36934] AH01626: authorization result of Require all granted: granted, referer: https://localhost/index.html
[Fri Oct 18 09:59:34.120202 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1845]], frames=1895/2905 (r/s)
[Fri Oct 18 09:59:34.120212 2019] [authz_core:debug] [pid 10:tid 139650130171648] mod_authz_core.c(820): [client 192.168.192.1:36934] AH01626: authorization result of <RequireAny>: granted, referer: https://localhost/index.html
[Fri Oct 18 09:59:34.120220 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1847]], frames=1895/2906 (r/s)
[Fri Oct 18 09:59:34.120235 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1849]], frames=1895/2907 (r/s)
[Fri Oct 18 09:59:34.120248 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1851]], frames=1895/2908 (r/s)
[Fri Oct 18 09:59:34.120286 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1853]], frames=1895/2909 (r/s)
[Fri Oct 18 09:59:34.120303 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1855]], frames=1895/2910 (r/s)
[Fri Oct 18 09:59:34.120311 2019] [ssl:debug] [pid 10:tid 139650146973440] ssl_engine_kernel.c(383): [client 192.168.192.1:36934] AH02034: Subsequent (No.2) HTTPS request received for child 554050783019 (server localhost:443), referer: https://localhost/index.html
[Fri Oct 18 09:59:34.120320 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1857]], frames=1895/2911 (r/s)
[Fri Oct 18 09:59:34.120337 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1859]], frames=1895/2912 (r/s)
[Fri Oct 18 09:59:34.120354 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1861]], frames=1895/2913 (r/s)
[Fri Oct 18 09:59:34.120363 2019] [authz_core:debug] [pid 10:tid 139650146973440] mod_authz_core.c(820): [client 192.168.192.1:36934] AH01626: authorization result of Require all granted: granted, referer: https://localhost/index.html
[Fri Oct 18 09:59:34.120378 2019] [authz_core:debug] [pid 10:tid 139650146973440] mod_authz_core.c(820): [client 192.168.192.1:36934] AH01626: authorization result of <RequireAny>: granted, referer: https://localhost/index.html
[Fri Oct 18 09:59:34.120378 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1863]], frames=1895/2914 (r/s)
[Fri Oct 18 09:59:34.122672 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1865]], frames=1895/2915 (r/s)
[Fri Oct 18 09:59:34.122922 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1867]], frames=1895/2916 (r/s)
[Fri Oct 18 09:59:34.122960 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1869]], frames=1895/2917 (r/s)
[Fri Oct 18 09:59:34.122979 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1871]], frames=1895/2918 (r/s)
[Fri Oct 18 09:59:34.123018 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1873]], frames=1895/2919 (r/s)
[Fri Oct 18 09:59:34.123030 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1875]], frames=1895/2920 (r/s)
[Fri Oct 18 09:59:34.123047 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1877]], frames=1895/2921 (r/s)
[Fri Oct 18 09:59:34.123064 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1879]], frames=1895/2922 (r/s)
[Fri Oct 18 09:59:34.123081 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1881]], frames=1895/2923 (r/s)
[Fri Oct 18 09:59:34.123097 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1883]], frames=1895/2924 (r/s)
[Fri Oct 18 09:59:34.123114 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1885]], frames=1895/2925 (r/s)
[Fri Oct 18 09:59:34.123195 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1887]], frames=1895/2926 (r/s)
[Fri Oct 18 09:59:34.123216 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1889]], frames=1895/2927 (r/s)
[Fri Oct 18 09:59:34.123233 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(593): [client 192.168.192.1:36934] AH03068: h2_session(128,BUSY,11): sent FRAME[RST_STREAM[length=4, flags=0, stream=1809]], frames=1895/2928 (r/s)
[Fri Oct 18 09:59:34.123276 2019] [http2:debug] [pid 10:tid 139649980819200] h2_session.c(267): [client 192.168.192.1:36934] AH03065: h2_stream(128-1809,CLOSED): closing with err=1 protocol error
The last line reports h2_stream(128-1809,CLOSED): closing with err=1 protocol.
I test this with the following environment:
Chrome Version 77.0.3865.120 (Official Build) (64-bit) on macOS Catalina 10.15
Apache 2.4.41 in a Docker container (image httpd:latest)
What I am missing ? Maybe it's an Apache bug ? A Chrome bug ? A bad Apache configuration ?
Thanks you in advance.
Apache2 crashes and there's no logging in the error.log, not even after setting the Loglevel to debug in the apache2.conf.
Owner of the error.log is root
No updates or changes were made on the Server
Tried to downgrade from Apache (apt-get install --reinstall apache2=2.4.18-2ubuntu3 apache2-bin=2.4.18-2ubuntu3 apache2-data=2.4.18-2ubuntu3) but that doesn't help.
service apache2 start:
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
systemctl status apache2.service:
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Tue 2017-04-04 16:06:03 UTC; 1min 26s ago
Docs: man:systemd-sysv-generator(8)
Process: 11071 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Apr 04 16:05:43 bpi-iot-ros systemd[1]: Starting LSB: Apache2 web server...
Apr 04 16:05:43 bpi-iot-ros apache2[11071]: * Starting Apache httpd web server apache2
Apr 04 16:06:03 bpi-iot-ros apache2[11071]: *
Apr 04 16:06:03 bpi-iot-ros apache2[11071]: * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Apr 04 16:06:03 bpi-iot-ros systemd[1]: apache2.service: Control process exited, code=exited status=1
Apr 04 16:06:03 bpi-iot-ros systemd[1]: Failed to start LSB: Apache2 web server.
Apr 04 16:06:03 bpi-iot-ros systemd[1]: apache2.service: Unit entered failed state.
Apr 04 16:06:03 bpi-iot-ros systemd[1]: apache2.service: Failed with result 'exit-code'.
● service.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
journalctl -xe:
Apr 04 16:09:22 bpi-iot-ros apache2[11191]: *
Apr 04 16:09:22 bpi-iot-ros apache2[11191]: * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Apr 04 16:09:22 bpi-iot-ros systemd[1]: apache2.service: Control process exited, code=exited status=1
Apr 04 16:09:22 bpi-iot-ros systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has failed.
--
-- The result is failed.
Apr 04 16:09:22 bpi-iot-ros systemd[1]: apache2.service: Unit entered failed state.
Apr 04 16:09:22 bpi-iot-ros systemd[1]: apache2.service: Failed with result 'exit-code'.
Error log, last lines from Monday:
[Mon Apr 03 08:56:07.530514 2017] [:error] [pid 30594] [client 192.168.2.185:52276] PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /var/www/nextcloud/lib/private/DB/Connection.php:60\nStack trace:\n#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()\n#2 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()\n#3 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): Doctrine\DBAL\Connection->getDatabasePlatform()\n#4 /var/www/nextcloud/lib/private/DB/Connection.php(147): Doctrine\DBAL\Connection->setTransactionIsolation(2)\n#5 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Obj in /var/www/nextcloud/lib/private/DB/Connection.php on line 60
[Mon Apr 03 08:56:12.034222 2017] [mpm_prefork:notice] [pid 625] AH00169: caught SIGTERM, shutting down
Edit:
apache2ctl configtest no Syntax errors.
apache2ctl -X
Child Process seems to hang up, can reach the SSL Warning (selfsigned) when attempting to reach the sitestarting
did a strace of Apache starting, some Childprocess exited with Errorcode 1 (huge File so i only copied the last Lines)
11028 open("/lib/arm-linux-gnueabihf/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
11028 read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\331i\1\0004\0\0\0"..., 512) = 512
11028 lseek(3, 894128, SEEK_SET) = 894128
11028 read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2960) = 2960
11028 lseek(3, 888324, SEEK_SET) = 888324
11028 read(3, "A2\0\0\0aeabi\0\1(\0\0\0\0057-A\0\6\n\7A\10\1\t\2\n\3\f"..., 51) = 51
11028 fstat64(3, {st_mode=S_IFREG|0755, st_size=897088, ...}) = 0
11028 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f72000
11028 mmap2(NULL, 963928, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6e3e000
11028 mprotect(0xb6f14000, 65536, PROT_NONE) = 0
11028 mmap2(0xb6f24000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd6000) = 0xb6f24000
11028 mmap2(0xb6f27000, 9560, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6f27000
11028 close(3) = 0
11028 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f71000
11028 set_tls(0xb6f714c0, 0xb6f71b98, 0xb6f7c050, 0xb6f714c0, 0xb6f7c050) = 0
11028 mprotect(0xb6f24000, 8192, PROT_READ) = 0
11028 mprotect(0xb6f51000, 8192, PROT_READ) = 0
11028 mprotect(0x21000, 4096, PROT_READ) = 0
11028 mprotect(0xb6f7b000, 4096, PROT_READ) = 0
11028 munmap(0xb6f73000, 21672) = 0
11028 ioctl(1, TCGETS, 0xbedb2554) = -1 EINVAL (Invalid argument)
11028 brk(NULL) = 0x1d23000
11028 brk(0x1d44000) = 0x1d44000
11028 stat64("/root/.terminfo", 0x1d23160) = -1 ENOENT (No such file or directory)
11028 stat64("/etc/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
11028 stat64("/lib/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
11028 stat64("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
11028 gettimeofday({1491321517, 321307}, NULL) = 0
11028 access("/etc/terminfo/x/xterm", R_OK) = -1 ENOENT (No such file or directory)
11028 access("/lib/terminfo/x/xterm", R_OK) = 0
11028 open("/lib/terminfo/x/xterm", O_RDONLY|O_LARGEFILE) = 3
11028 fstat64(3, {st_mode=S_IFREG|0644, st_size=3361, ...}) = 0
11028 read(3, "\32\1)\0&\0\17\0\235\1u\5xterm|xterm-debian|X"..., 4096) = 3361
11028 read(3, "", 4096) = 0
11028 close(3) = 0
11028 gettimeofday({1491321517, 324975}, NULL) = 0
11028 ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
11028 ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
11028 ioctl(2, TIOCGWINSZ, {ws_row=54, ws_col=189, ws_xpixel=0, ws_ypixel=0}) = 0
11028 fstat64(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
11028 write(1, "\33[39;49m", 8) = 8
10941 <... read resumed> "\33[39;49m", 128) = 8
11028 exit_group(0) = ?
10941 read(3, <unfinished ...>
11028 +++ exited with 0 +++
10941 <... read resumed> "", 128) = 0
10941 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=11028, si_uid=0, si_status=0, si_utime=0, si_stime=1} ---
10941 sigreturn({mask=[]}) = 0
10941 close(3) = 0
10941 wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 11028
10941 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb6fae418) = 11029
11029 close(12 <unfinished ...>
10941 wait4(-1, <unfinished ...>
11029 <... close resumed> ) = 0
11029 close(11) = 0
11029 close(10) = 0
11029 execve("/bin/echo", ["/bin/echo", "-e", " \33[31mfailed!\33[39;49m"], [/* 19 vars */]) = 0
11029 brk(NULL) = 0x318000
11029 uname({sysname="Linux", nodename="bpi-iot-ros", ...}) = 0
11029 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
11029 mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f2e000
11029 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
11029 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
11029 fstat64(3, {st_mode=S_IFREG|0644, st_size=21672, ...}) = 0
11029 mmap2(NULL, 21672, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6f28000
11029 close(3) = 0
11029 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
11029 open("/lib/arm-linux-gnueabihf/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
11029 read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\331i\1\0004\0\0\0"..., 512) = 512
11029 lseek(3, 894128, SEEK_SET) = 894128
11029 read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2960) = 2960
11029 lseek(3, 888324, SEEK_SET) = 888324
11029 read(3, "A2\0\0\0aeabi\0\1(\0\0\0\0057-A\0\6\n\7A\10\1\t\2\n\3\f"..., 51) = 51
11029 fstat64(3, {st_mode=S_IFREG|0755, st_size=897088, ...}) = 0
11029 mmap2(NULL, 963928, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6e1d000
11029 mprotect(0xb6ef3000, 65536, PROT_NONE) = 0
11029 mmap2(0xb6f03000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd6000) = 0xb6f03000
11029 mmap2(0xb6f06000, 9560, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6f06000
11029 close(3) = 0
11029 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f27000
11029 set_tls(0xb6f27870, 0xb6f27f48, 0xb6f31050, 0xb6f27870, 0xb6f31050) = 0
11029 mprotect(0xb6f03000, 8192, PROT_READ) = 0
11029 mprotect(0x24000, 4096, PROT_READ) = 0
11029 mprotect(0xb6f30000, 4096, PROT_READ) = 0
11029 munmap(0xb6f28000, 21672) = 0
11029 brk(NULL) = 0x318000
11029 brk(0x339000) = 0x339000
11029 fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
11029 write(1, " \33[31mfailed!\33[39;49m\n", 22) = 22
11029 close(1) = 0
11029 close(2) = 0
11029 exit_group(0) = ?
11029 +++ exited with 0 +++
10941 <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 11029
10941 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=11029, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
10941 sigreturn({mask=[]}) = 11029
10941 close(12) = 0
10941 close(11) = 0
10941 exit_group(1) = ?
10941 +++ exited with 1 +++
(Posted on behalf of the OP).
I dont know exactly how, but it's solved... maybe reinstalling libapache2-mod-php7.0 was the failure.
I've been trying to integrate a DJANGO-REST WS into apache using MOD_WSGI, but after some long hours of trying to apply all debugging techniques and different wsgi scripts, I would appreciate some help.
Server version: Apache/2.2.22 (Ubuntu)
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
MOD_WSGI Version: 3.3
Currently my WSGI file is the following:
"""
WSGI config for zighome_rest project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os, sys
sys.path.append('/usr/local/ZigHomeWS')
sys.path.append('/usr/local/ZigHomeWS/zighome_rest')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zighome_rest.settings")
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
and my virtual host is configured as below:
<VirtualHost *:80>
ServerAdmin my.email#gmail.com
ServerName my.server.name
DocumentRoot /usr/local/DummyApp
WSGIDaemonProcess ZigHomeWS python-path=/usr/local/ZigHomeWS/zighome_rest:/usr/lib/python2.7:/usr/local/lib/python2.7/site-packages/django
WSGIProcessGroup ZigHomeWS
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias /ZigHomeWS /usr/local/ZigHomeWS/zighome_rest/zighome_rest/WSGI/django.wsgi
WSGIPassAuthorization On
<Directory /usr/local/ZigHomeWS/zighome_rest>
<Files django.wsgi>
Order deny,allow
Allow from all
</Files>
</Directory>
<Directory /usr/local/DummyApp>
Order deny,allow
Allow from all
</Directory>
ErrorLog /var/log/apache2/error_ZigHomeWS.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel info
</VirtualHost>
The current settings.py file has the following configuration:
"""
Django settings for zighome_rest project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '6h34&#m=1t4!(axkhz1+%6%u8^o(7^ao500pl#*+=$sk(a846#'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'configuration',
'execution',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'zighome_rest.urls'
WSGI_APPLICATION = 'zighome_rest.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/usr/local/ZigHomeWS/zighome_rest/zighome.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/'
As soon as I call one of the services, with curl, like so:
curl -X POST http://my.server.name/ZigHomeWS/execution/start/ -u user:passwd
I get the following error logged:
[Sat Sep 27 19:15:28 2014] [info] mod_wsgi (pid=13351): Adding '/usr/local/ZigHomeWS/zighome_rest' to path.
[Sat Sep 27 19:15:28 2014] [info] mod_wsgi (pid=13351): Adding '/usr/lib/python2.7' to path.
[Sat Sep 27 19:15:28 2014] [info] mod_wsgi (pid=13351): Adding '/usr/local/lib/python2.7/site-packages/django' to path.
[Sat Sep 27 19:15:32 2014] [info] [client 46.189.221.224] mod_wsgi (pid=13351, process='ZigHomeWS', application=''): Loading WSGI script '/usr/local/ZigHomeWS/zighome_rest/zighome_rest/WSGI/django.wsgi'.
[Sat Sep 27 18:15:33 2014] [error] No handlers could be found for logger "django.request"
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] mod_wsgi (pid=13351): Exception occurred processing WSGI script '/usr/local/ZigHomeWS/zighome_rest/zighome_rest/WSGI/django.wsgi'.
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] Traceback (most recent call last):
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] response = self.get_response(request)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 199, in get_response
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 236, in handle_uncaught_exception
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return debug.technical_500_response(request, *exc_info)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 91, in technical_500_response
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] html = reporter.get_traceback_html()
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/views/debug.py", line 350, in get_traceback_html
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return t.render(c)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 148, in render
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return self._render(context)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 142, in _render
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return self.nodelist.render(context)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 844, in render
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] bit = self.render_node(node, context)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 80, in render_node
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return node.render(context)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 90, in render
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] output = self.filter_expression.resolve(context)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 624, in resolve
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] new_obj = func(obj, *arg_vals)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/template/defaultfilters.py", line 769, in date
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return format(value, arg)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 343, in format
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return df.format(format_string)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 35, in format
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] pieces.append(force_text(getattr(self, piece)()))
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 268, in r
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return self.format('D, j M Y H:i:s O')
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/dateformat.py", line 35, in format
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] pieces.append(force_text(getattr(self, piece)()))
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py", line 85, in force_text
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] s = six.text_type(s)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 144, in __text_cast
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return func(*self.__args, **self.__kw)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 83, in ugettext
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return _trans.ugettext(message)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 325, in ugettext
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] return do_translate(message, 'ugettext')
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 306, in do_translate
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] _default = translation(settings.LANGUAGE_CODE)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 209, in translation
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] default_translation = _fetch(settings.LANGUAGE_CODE)
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] File "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 189, in _fetch
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] "The translation infrastructure cannot be initialized before the "
[Sat Sep 27 18:15:33 2014] [error] [client 46.189.221.224] AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.
I must confess that adding "/usr/local/lib/python2.7/site-packages/django" was just a measure of desperation, which end-up by resulting on nothing.
One thing I should probably mention, although it shouldn't make any difference to the solution, is that the core system is actually a C++ system which I wrapped up with SWIG.
Needless to say, it's working on the Django-REST development environment.
Last but not least, if in the WSGI script file I change these two lines:
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
by these:
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
It will crash instead of providing the stack trace in the log file:
[Sat Sep 27 19:44:10 2014] [error] [client X.X.X.X] Premature end of script headers: django.wsgi
I end up applying the recommended debugging techniques but unfortunately it wasn't very helpful, since the stack-trace of gdb just gave me:
(gdb) cont
Continuing.
[New Thread 0x7fc6d4de9700 (LWP 9312)]
[New Thread 0x7fc6d45e8700 (LWP 9313)]
[Thread 0x7fc6dde3a700 (LWP 9242) exited]
[Thread 0x7fc6d45e8700 (LWP 9313) exited]
[Thread 0x7fc6d4de9700 (LWP 9312) exited]
[Thread 0x7fc6dd639700 (LWP 9245) exited]
[Thread 0x7fc6e364a740 (LWP 9216) exited]
[Inferior 1 (process 9216) exited with code 01]
Investigation:
So... I've just realized something.
From what I read from several sites on the web, I should be really using this call:
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
on the WSGI script. Since I was getting nowhere fast with these two lines of code, which were crashing all the time, I remembered to call any other web-service that I have created and VOILA!! It works. (Don't know why I haven't try this before...stubbornness I guess)
Now, one of the major differences between the two web-services, is that one, only parses some XML file and adds data to the sqlite3 database and the other one (the one that crashes), starts the whole system, which implies the creation of multiple threads and so forth.
Thus, I'm now looking for any threads related documented issue I can find with modwsgi.
I hope you can provide me with some help
Thank you
I've updated my wsgi.py file from:
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
To:
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
I have a problem drawing objects passing this graphic context
CGContextRef context = UIGraphicsGetCurrentContext();
Here is the code I use to draw
- (void) draw: (CGContextRef) gc
{
CGFloat black[4] = {0.0f, 0.0f, 0.0f, 1.0f}; // R G B + Alpha
CGPoint p [2];
p[0].x = xStart ;
p[0].y = yStart ;
p[1].x = xEnd ;
p[1].y = yEnd ;
CGContextSetStrokeColor(gc, black); //Definie la couleur
CGContextStrokeLineSegments(gc, p, 2 ) ;
}
Some object draw, other don't (very strange) and in the console I read:
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextDrawImage: invalid context 0x0
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextSetStrokeColor: invalid context 0x0
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextStrokeLineSegments: invalid context 0x0
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextSetStrokeColor: invalid context 0x0
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextStrokeLineSegments: invalid context 0x0
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextSetStrokeColor: invalid context 0x0
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextStrokeLineSegments: invalid context 0x0
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextSetStrokeColor: invalid context 0x0
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextStrokeLineSegments: invalid context 0x0
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextSetStrokeColor: invalid context 0x0
Thu Mar 24 21:53:59 MacBook-Air-di-Michele-Giarratana.local IVBricker[381] <Error>: CGContextStrokeLineSegments: invalid context 0x0
So I can't speak to the invalid content errors because we'd need to see the rest of the code but it looks like the colour space could be incorrect (it's not RGB by default). Add this before you call stroke:
CGContextSetStrokeColorSpace(gc, CGColorSpaceCreateDeviceRGB());