Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
249d2678
Commit
249d2678
authored
8 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Propagated broken connection to ConnPool
parent
85e0ea12
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rdbms/ConnPool.cpp
+15
-7
15 additions, 7 deletions
rdbms/ConnPool.cpp
with
15 additions
and
7 deletions
rdbms/ConnPool.cpp
+
15
−
7
View file @
249d2678
...
...
@@ -57,10 +57,15 @@ void ConnPool::createConns(const uint64_t nbConns) {
//------------------------------------------------------------------------------
PooledConn
ConnPool
::
getConn
()
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
m_connsMutex
);
while
(
m_conns
.
size
()
==
0
)
{
while
(
m_conns
.
size
()
==
0
&&
m_nbConnsOnLoan
==
m_maxNbConns
)
{
m_connsCv
.
wait
(
lock
);
}
if
(
m_conns
.
size
()
==
0
)
{
m_conns
.
push_back
(
m_connFactory
.
create
());
}
std
::
unique_ptr
<
Conn
>
conn
=
std
::
move
(
m_conns
.
front
());
m_conns
.
pop_front
();
m_nbConnsOnLoan
++
;
...
...
@@ -92,18 +97,21 @@ void ConnPool::returnConn(Conn *const conn) {
// Else the connection is closed
}
else
{
// Close all connections in the pool and put the returning connection back
// in the pool. A closed connection within the pool is reopened when it is
// pulled from the pool.
// Delete the connection
delete
conn
;
// A closed connection is rare and usually means the underlying TCP/IP
// connection, if there is one, has been lost. Delete all the connections
// currently in the pool because their underlying TCP/IP connections may
// also have been lost.
std
::
unique_lock
<
std
::
mutex
>
lock
(
m_connsMutex
);
for
(
auto
&
connInPool
:
m_conns
)
{
conn
InPool
->
close
();
while
(
!
m_conns
.
empty
()
)
{
m_
conn
s
.
pop_front
();
}
if
(
0
==
m_nbConnsOnLoan
)
{
throw
exception
::
Exception
(
"Would have reached -1 connections on loan"
);
}
m_nbConnsOnLoan
--
;
m_conns
.
emplace_back
(
conn
);
m_connsCv
.
notify_one
();
}
}
catch
(
exception
::
Exception
&
ex
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment