Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
eee8bd04
Commit
eee8bd04
authored
Jun 21, 2016
by
DeepakVerma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First time ConnectTimeout error when abortonconnect is false
parent
44ace4ef
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
5 deletions
+38
-5
ConnectionFailedErrors.cs
StackExchange.Redis.Tests/ConnectionFailedErrors.cs
+17
-0
ConnectionMultiplexer.cs
...change.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
+13
-2
ExceptionFactory.cs
StackExchange.Redis/StackExchange/Redis/ExceptionFactory.cs
+7
-2
ServerEndPoint.cs
StackExchange.Redis/StackExchange/Redis/ServerEndPoint.cs
+1
-1
No files found.
StackExchange.Redis.Tests/ConnectionFailedErrors.cs
View file @
eee8bd04
...
...
@@ -87,6 +87,23 @@ public void SocketFailureError()
}
}
[
Test
]
public
void
AbortOnConnectFailFalseConnectTimeoutError
()
{
string
name
,
password
;
GetAzureCredentials
(
out
name
,
out
password
);
var
options
=
new
ConfigurationOptions
();
options
.
EndPoints
.
Add
(
name
+
".redis.cache.windows.net"
);
options
.
Ssl
=
true
;
options
.
ConnectTimeout
=
0
;
options
.
Password
=
password
;
using
(
var
muxer
=
ConnectionMultiplexer
.
Connect
(
options
))
{
var
ex
=
Assert
.
Throws
<
RedisConnectionException
>(()
=>
muxer
.
GetDatabase
().
Ping
());
Assert
.
That
(
ex
.
Message
,
Does
.
Contain
(
"ConnectTimeout"
));
}
}
[
Test
]
public
void
CheckFailureRecovered
()
{
...
...
StackExchange.Redis/StackExchange/Redis/ConnectionMultiplexer.cs
View file @
eee8bd04
...
...
@@ -871,8 +871,12 @@ private static ConnectionMultiplexer ConnectImpl(Func<ConnectionMultiplexer> mul
{
task
.
ObserveErrors
();
if
(
muxer
.
RawConfig
.
AbortOnConnectFail
)
{
throw
ExceptionFactory
.
UnableToConnect
(
"Timeout"
);
{
throw
ExceptionFactory
.
UnableToConnect
(
"ConnectTimeout"
);
}
else
{
muxer
.
LastException
=
ExceptionFactory
.
UnableToConnect
(
"ConnectTimeout"
);
}
}
if
(!
task
.
Result
)
throw
ExceptionFactory
.
UnableToConnect
(
muxer
.
failureMessage
);
...
...
@@ -984,6 +988,9 @@ private void OnHeartbeat()
return
unchecked
(
Environment
.
TickCount
-
VolatileWrapper
.
Read
(
ref
lastHeartbeatTicks
))
/
1000
;
}
}
internal
Exception
LastException
{
get
;
set
;
}
internal
static
long
LastGlobalHeartbeatSecondsAgo
=>
unchecked
(
Environment
.
TickCount
-
VolatileWrapper
.
Read
(
ref
lastGlobalHeartbeatTicks
))
/
1000
;
internal
CompletionManager
UnprocessableCompletionManager
=>
unprocessableCompletionManager
;
...
...
@@ -1129,6 +1136,10 @@ public bool Configure(TextWriter log = null)
{
throw
new
TimeoutException
();
}
else
{
LastException
=
new
TimeoutException
(
"ConnectTimeout"
);
}
return
false
;
}
return
task
.
Result
;
...
...
StackExchange.Redis/StackExchange/Redis/ExceptionFactory.cs
View file @
eee8bd04
...
...
@@ -102,7 +102,7 @@ internal static Exception NoConnectionAvailable(bool includeDetail, RedisCommand
serverSnapshot
=
new
ServerEndPoint
[]
{
server
};
}
var
innerException
=
GetServerSnapshot
InnerExceptions
(
serverSnapshot
);
var
innerException
=
Populate
InnerExceptions
(
serverSnapshot
);
StringBuilder
exceptionmessage
=
new
StringBuilder
(
"No connection is available to service this operation: "
);
exceptionmessage
.
Append
(
commandLabel
);
...
...
@@ -122,11 +122,16 @@ internal static Exception NoConnectionAvailable(bool includeDetail, RedisCommand
return
ex
;
}
internal
static
Exception
GetServerSnapshot
InnerExceptions
(
ServerEndPoint
[]
serverSnapshot
)
internal
static
Exception
Populate
InnerExceptions
(
ServerEndPoint
[]
serverSnapshot
)
{
List
<
Exception
>
innerExceptions
=
new
List
<
Exception
>();
if
(
serverSnapshot
!=
null
)
{
if
(
serverSnapshot
.
Length
>
0
&&
serverSnapshot
[
0
].
Multiplexer
.
LastException
!=
null
)
{
innerExceptions
.
Add
(
serverSnapshot
[
0
].
Multiplexer
.
LastException
);
}
for
(
int
i
=
0
;
i
<
serverSnapshot
.
Length
;
i
++)
{
if
(
serverSnapshot
[
i
].
LastException
!=
null
)
...
...
StackExchange.Redis/StackExchange/Redis/ServerEndPoint.cs
View file @
eee8bd04
...
...
@@ -101,7 +101,7 @@ internal Exception LastException
//check if subscription endpoint has a better lastexception
if
(
tmp2
!=
null
&&
tmp2
.
LastException
!=
null
)
{
if
(!
tmp2
.
LastException
.
Data
[
"Redis-FailureType"
].
ToString
().
Equals
(
ConnectionFailureType
.
UnableToConnect
.
ToString
()))
if
(
tmp2
.
LastException
.
Data
.
Contains
(
"Redis-FailureType"
)
&&
!
tmp2
.
LastException
.
Data
[
"Redis-FailureType"
].
ToString
().
Equals
(
ConnectionFailureType
.
UnableToConnect
.
ToString
()))
{
return
tmp2
.
LastException
;
}
...
...
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