Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
177d0a51
Commit
177d0a51
authored
Feb 21, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: More logging for backend connection initiation
parent
dfc02843
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
13 deletions
+55
-13
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+41
-6
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+14
-7
No files found.
src/shrpx_http2_session.cc
View file @
177d0a51
...
@@ -258,8 +258,10 @@ int Http2Session::initiate_connection() {
...
@@ -258,8 +258,10 @@ int Http2Session::initiate_connection() {
if
(
state_
==
DISCONNECTED
)
{
if
(
state_
==
DISCONNECTED
)
{
if
(
worker_blocker
->
blocked
())
{
if
(
worker_blocker
->
blocked
())
{
DLOG
(
INFO
,
this
)
if
(
LOG_ENABLED
(
INFO
))
{
<<
"Worker wide backend connection was blocked temporarily"
;
SSLOG
(
INFO
,
this
)
<<
"Worker wide backend connection was blocked temporarily"
;
}
return
-
1
;
return
-
1
;
}
}
...
@@ -277,8 +279,8 @@ int Http2Session::initiate_connection() {
...
@@ -277,8 +279,8 @@ int Http2Session::initiate_connection() {
if
(
connect_blocker
->
blocked
())
{
if
(
connect_blocker
->
blocked
())
{
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
DC
LOG
(
INFO
,
this
)
<<
"Backend server "
SS
LOG
(
INFO
,
this
)
<<
"Backend server "
<<
(
addr
.
host_unix
?
addr
.
host
:
addr
.
hostport
)
<<
util
::
to_numeric_addr
(
&
addr
.
addr
)
<<
" was not available temporarily"
;
<<
" was not available temporarily"
;
}
}
...
@@ -312,6 +314,11 @@ int Http2Session::initiate_connection() {
...
@@ -312,6 +314,11 @@ int Http2Session::initiate_connection() {
conn_
.
fd
=
util
::
create_nonblock_socket
(
proxy
.
addr
.
su
.
storage
.
ss_family
);
conn_
.
fd
=
util
::
create_nonblock_socket
(
proxy
.
addr
.
su
.
storage
.
ss_family
);
if
(
conn_
.
fd
==
-
1
)
{
if
(
conn_
.
fd
==
-
1
)
{
auto
error
=
errno
;
SSLOG
(
WARN
,
this
)
<<
"Backend proxy socket() failed; addr="
<<
util
::
to_numeric_addr
(
&
proxy
.
addr
)
<<
", errno="
<<
error
;
worker_blocker
->
on_failure
();
worker_blocker
->
on_failure
();
return
-
1
;
return
-
1
;
}
}
...
@@ -320,8 +327,11 @@ int Http2Session::initiate_connection() {
...
@@ -320,8 +327,11 @@ int Http2Session::initiate_connection() {
rv
=
connect
(
conn_
.
fd
,
&
proxy
.
addr
.
su
.
sa
,
proxy
.
addr
.
len
);
rv
=
connect
(
conn_
.
fd
,
&
proxy
.
addr
.
su
.
sa
,
proxy
.
addr
.
len
);
if
(
rv
!=
0
&&
errno
!=
EINPROGRESS
)
{
if
(
rv
!=
0
&&
errno
!=
EINPROGRESS
)
{
SSLOG
(
ERROR
,
this
)
<<
"Failed to connect to the proxy "
<<
proxy
.
host
auto
error
=
errno
;
<<
":"
<<
proxy
.
port
;
SSLOG
(
WARN
,
this
)
<<
"Backend proxy connect() failed; addr="
<<
util
::
to_numeric_addr
(
&
proxy
.
addr
)
<<
", errno="
<<
error
;
connect_blocker
->
on_failure
();
connect_blocker
->
on_failure
();
return
-
1
;
return
-
1
;
}
}
...
@@ -382,6 +392,11 @@ int Http2Session::initiate_connection() {
...
@@ -382,6 +392,11 @@ int Http2Session::initiate_connection() {
conn_
.
fd
=
conn_
.
fd
=
util
::
create_nonblock_socket
(
addr_
->
addr
.
su
.
storage
.
ss_family
);
util
::
create_nonblock_socket
(
addr_
->
addr
.
su
.
storage
.
ss_family
);
if
(
conn_
.
fd
==
-
1
)
{
if
(
conn_
.
fd
==
-
1
)
{
auto
error
=
errno
;
SSLOG
(
WARN
,
this
)
<<
"socket() failed; addr="
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
)
<<
", errno="
<<
error
;
worker_blocker
->
on_failure
();
worker_blocker
->
on_failure
();
return
-
1
;
return
-
1
;
}
}
...
@@ -393,6 +408,11 @@ int Http2Session::initiate_connection() {
...
@@ -393,6 +408,11 @@ int Http2Session::initiate_connection() {
const_cast
<
sockaddr
*>
(
&
addr_
->
addr
.
su
.
sa
),
const_cast
<
sockaddr
*>
(
&
addr_
->
addr
.
su
.
sa
),
addr_
->
addr
.
len
);
addr_
->
addr
.
len
);
if
(
rv
!=
0
&&
errno
!=
EINPROGRESS
)
{
if
(
rv
!=
0
&&
errno
!=
EINPROGRESS
)
{
auto
error
=
errno
;
SSLOG
(
WARN
,
this
)
<<
"connect() failed; addr="
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
)
<<
", errno="
<<
error
;
connect_blocker
->
on_failure
();
connect_blocker
->
on_failure
();
return
-
1
;
return
-
1
;
}
}
...
@@ -411,6 +431,11 @@ int Http2Session::initiate_connection() {
...
@@ -411,6 +431,11 @@ int Http2Session::initiate_connection() {
util
::
create_nonblock_socket
(
addr_
->
addr
.
su
.
storage
.
ss_family
);
util
::
create_nonblock_socket
(
addr_
->
addr
.
su
.
storage
.
ss_family
);
if
(
conn_
.
fd
==
-
1
)
{
if
(
conn_
.
fd
==
-
1
)
{
auto
error
=
errno
;
SSLOG
(
WARN
,
this
)
<<
"socket() failed; addr="
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
)
<<
", errno="
<<
error
;
worker_blocker
->
on_failure
();
worker_blocker
->
on_failure
();
return
-
1
;
return
-
1
;
}
}
...
@@ -420,6 +445,11 @@ int Http2Session::initiate_connection() {
...
@@ -420,6 +445,11 @@ int Http2Session::initiate_connection() {
rv
=
connect
(
conn_
.
fd
,
const_cast
<
sockaddr
*>
(
&
addr_
->
addr
.
su
.
sa
),
rv
=
connect
(
conn_
.
fd
,
const_cast
<
sockaddr
*>
(
&
addr_
->
addr
.
su
.
sa
),
addr_
->
addr
.
len
);
addr_
->
addr
.
len
);
if
(
rv
!=
0
&&
errno
!=
EINPROGRESS
)
{
if
(
rv
!=
0
&&
errno
!=
EINPROGRESS
)
{
auto
error
=
errno
;
SSLOG
(
WARN
,
this
)
<<
"connect() failed; addr="
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
)
<<
", errno="
<<
error
;
connect_blocker
->
on_failure
();
connect_blocker
->
on_failure
();
return
-
1
;
return
-
1
;
}
}
...
@@ -1648,6 +1678,11 @@ int Http2Session::connected() {
...
@@ -1648,6 +1678,11 @@ int Http2Session::connected() {
auto
&
connect_blocker
=
addr_
->
connect_blocker
;
auto
&
connect_blocker
=
addr_
->
connect_blocker
;
if
(
!
util
::
check_socket_connected
(
conn_
.
fd
))
{
if
(
!
util
::
check_socket_connected
(
conn_
.
fd
))
{
if
(
LOG_ENABLED
(
INFO
))
{
SSLOG
(
INFO
,
this
)
<<
"Backend connect failed; addr="
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
);
}
connect_blocker
->
on_failure
();
connect_blocker
->
on_failure
();
return
-
1
;
return
-
1
;
...
...
src/shrpx_http_downstream_connection.cc
View file @
177d0a51
...
@@ -146,8 +146,10 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
...
@@ -146,8 +146,10 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
auto
worker_blocker
=
worker_
->
get_connect_blocker
();
auto
worker_blocker
=
worker_
->
get_connect_blocker
();
if
(
worker_blocker
->
blocked
())
{
if
(
worker_blocker
->
blocked
())
{
DLOG
(
INFO
,
this
)
if
(
LOG_ENABLED
(
INFO
))
{
<<
"Worker wide backend connection was blocked temporarily"
;
DCLOG
(
INFO
,
this
)
<<
"Worker wide backend connection was blocked temporarily"
;
}
return
SHRPX_ERR_NETWORK
;
return
SHRPX_ERR_NETWORK
;
}
}
...
@@ -179,7 +181,7 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
...
@@ -179,7 +181,7 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
if
(
connect_blocker
->
blocked
())
{
if
(
connect_blocker
->
blocked
())
{
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
DCLOG
(
INFO
,
this
)
<<
"Backend server "
DCLOG
(
INFO
,
this
)
<<
"Backend server "
<<
(
addr
.
host_unix
?
addr
.
host
:
addr
.
hostport
)
<<
util
::
to_numeric_addr
(
&
addr
.
addr
)
<<
" was not available temporarily"
;
<<
" was not available temporarily"
;
}
}
...
@@ -194,7 +196,9 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
...
@@ -194,7 +196,9 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
if
(
conn_
.
fd
==
-
1
)
{
if
(
conn_
.
fd
==
-
1
)
{
auto
error
=
errno
;
auto
error
=
errno
;
DCLOG
(
WARN
,
this
)
<<
"socket() failed; errno="
<<
error
;
DCLOG
(
WARN
,
this
)
<<
"socket() failed; addr="
<<
util
::
to_numeric_addr
(
&
addr
.
addr
)
<<
", errno="
<<
error
;
worker_blocker
->
on_failure
();
worker_blocker
->
on_failure
();
...
@@ -207,7 +211,9 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
...
@@ -207,7 +211,9 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
rv
=
connect
(
conn_
.
fd
,
&
addr
.
addr
.
su
.
sa
,
addr
.
addr
.
len
);
rv
=
connect
(
conn_
.
fd
,
&
addr
.
addr
.
su
.
sa
,
addr
.
addr
.
len
);
if
(
rv
!=
0
&&
errno
!=
EINPROGRESS
)
{
if
(
rv
!=
0
&&
errno
!=
EINPROGRESS
)
{
auto
error
=
errno
;
auto
error
=
errno
;
DCLOG
(
WARN
,
this
)
<<
"connect() failed; errno="
<<
error
;
DCLOG
(
WARN
,
this
)
<<
"connect() failed; addr="
<<
util
::
to_numeric_addr
(
&
addr
.
addr
)
<<
", errno="
<<
error
;
connect_blocker
->
on_failure
();
connect_blocker
->
on_failure
();
close
(
conn_
.
fd
);
close
(
conn_
.
fd
);
...
@@ -1034,7 +1040,8 @@ int HttpDownstreamConnection::connected() {
...
@@ -1034,7 +1040,8 @@ int HttpDownstreamConnection::connected() {
conn_
.
wlimit
.
stopw
();
conn_
.
wlimit
.
stopw
();
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
DLOG
(
INFO
,
this
)
<<
"downstream connect failed"
;
DCLOG
(
INFO
,
this
)
<<
"Backend connect failed; addr="
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
);
}
}
connect_blocker
->
on_failure
();
connect_blocker
->
on_failure
();
...
@@ -1045,7 +1052,7 @@ int HttpDownstreamConnection::connected() {
...
@@ -1045,7 +1052,7 @@ int HttpDownstreamConnection::connected() {
}
}
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
DLOG
(
INFO
,
this
)
<<
"Connected to downstream host"
;
D
C
LOG
(
INFO
,
this
)
<<
"Connected to downstream host"
;
}
}
connect_blocker
->
on_success
();
connect_blocker
->
on_success
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment