MongoDB - The connection is not disconnected for a long time











up vote
0
down vote

favorite












I am building a system that outputs information such as visit information and page transition of the user who visited the website to MongoDB,
The MongoDB connection pool of the server of the web site became MAX and it ceased to MongoDB from the web site.



The MongoDB service is configured with the following configuration.



mongos server#1 service:mongos、config
mongos server#2 service:mongos、config、rs01arbiter
mongos server#3 service:mongos、config、rs02arbiter
node#1 service:rs01(secondary)、rs02(secondary)
node#2 service:rs01(primary)、rs02(primary)



※Originally the following state is set, but OS is restarted, primary has dropped to node # 2, but it is left as it is
node#1 service:rs01(primary)、rs02(secondary)
node#2 service:rs01(secondary)、rs02(primary)



From this state, we restarted the OS of node # 2.
rs 01 and rs 02 of node # 1 were promoted to primary. rs01, rs02 of node # 2 demoted to secondary.I confirmed it from the log.



However, it happened that more connections would take more than 1 to 2 hours from OS reboot on node # 2 to expire.
And the MongoDB connection pool of the server of the web site became MAX and it became not connected to MongoDB from the web site.
Normally it will be out of connection in about 30 minutes at the longest.
I thought that node # 1 works as Primary, so I thought it would work normally, but I do not know why the connection is not disconnected for a long time.



If you encounter similar events, please let me know if anyone knows the solution or workaround.










share|improve this question






















  • It would be helpful to specify the mongoDB version. Also check if you are using keepAlive on the connection. What is your connection pool setting?
    – Akrion
    Nov 8 at 5:00










  • Thanks for the advice. The version of MongoDB is "MongoDB 3.0.12". The application connected to MongoDB is built with .net c # and is running on Windows Server 2012 R2. TCP Keepalive remains the default setting. Also when connecting from application socketOptions.keepAlive has not changed. The connectionString of the application also does not set the option as follows. <add name="config" connectionString="mongodb://user:pass@mongos1:27017,mongos2:27017,mongos3:27017/config"/>
    – m.kawasaki
    Nov 8 at 5:25










  • What is the default setting for keepAlive on that mongoDB version? Can you try to disable it? I assume your connection pool is 5 if using the node mongoDB driver etc.
    – Akrion
    Nov 8 at 5:30










  • I examined KeepAlive, but it was not found in ConnectionString's Option, nor was it found on the source code of MongoDB.Driver.dll (version 1.10.0.62). How do I know if you are using KeepAlive or not?
    – m.kawasaki
    Nov 9 at 2:11










  • From the connection source application, I am connecting to MongoDB with the C # .NET driver (MongoDB.Driver.dll (version 1.10.0.62)).
    – m.kawasaki
    Nov 9 at 2:42















up vote
0
down vote

favorite












I am building a system that outputs information such as visit information and page transition of the user who visited the website to MongoDB,
The MongoDB connection pool of the server of the web site became MAX and it ceased to MongoDB from the web site.



The MongoDB service is configured with the following configuration.



mongos server#1 service:mongos、config
mongos server#2 service:mongos、config、rs01arbiter
mongos server#3 service:mongos、config、rs02arbiter
node#1 service:rs01(secondary)、rs02(secondary)
node#2 service:rs01(primary)、rs02(primary)



※Originally the following state is set, but OS is restarted, primary has dropped to node # 2, but it is left as it is
node#1 service:rs01(primary)、rs02(secondary)
node#2 service:rs01(secondary)、rs02(primary)



From this state, we restarted the OS of node # 2.
rs 01 and rs 02 of node # 1 were promoted to primary. rs01, rs02 of node # 2 demoted to secondary.I confirmed it from the log.



However, it happened that more connections would take more than 1 to 2 hours from OS reboot on node # 2 to expire.
And the MongoDB connection pool of the server of the web site became MAX and it became not connected to MongoDB from the web site.
Normally it will be out of connection in about 30 minutes at the longest.
I thought that node # 1 works as Primary, so I thought it would work normally, but I do not know why the connection is not disconnected for a long time.



If you encounter similar events, please let me know if anyone knows the solution or workaround.










share|improve this question






















  • It would be helpful to specify the mongoDB version. Also check if you are using keepAlive on the connection. What is your connection pool setting?
    – Akrion
    Nov 8 at 5:00










  • Thanks for the advice. The version of MongoDB is "MongoDB 3.0.12". The application connected to MongoDB is built with .net c # and is running on Windows Server 2012 R2. TCP Keepalive remains the default setting. Also when connecting from application socketOptions.keepAlive has not changed. The connectionString of the application also does not set the option as follows. <add name="config" connectionString="mongodb://user:pass@mongos1:27017,mongos2:27017,mongos3:27017/config"/>
    – m.kawasaki
    Nov 8 at 5:25










  • What is the default setting for keepAlive on that mongoDB version? Can you try to disable it? I assume your connection pool is 5 if using the node mongoDB driver etc.
    – Akrion
    Nov 8 at 5:30










  • I examined KeepAlive, but it was not found in ConnectionString's Option, nor was it found on the source code of MongoDB.Driver.dll (version 1.10.0.62). How do I know if you are using KeepAlive or not?
    – m.kawasaki
    Nov 9 at 2:11










  • From the connection source application, I am connecting to MongoDB with the C # .NET driver (MongoDB.Driver.dll (version 1.10.0.62)).
    – m.kawasaki
    Nov 9 at 2:42













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am building a system that outputs information such as visit information and page transition of the user who visited the website to MongoDB,
The MongoDB connection pool of the server of the web site became MAX and it ceased to MongoDB from the web site.



The MongoDB service is configured with the following configuration.



mongos server#1 service:mongos、config
mongos server#2 service:mongos、config、rs01arbiter
mongos server#3 service:mongos、config、rs02arbiter
node#1 service:rs01(secondary)、rs02(secondary)
node#2 service:rs01(primary)、rs02(primary)



※Originally the following state is set, but OS is restarted, primary has dropped to node # 2, but it is left as it is
node#1 service:rs01(primary)、rs02(secondary)
node#2 service:rs01(secondary)、rs02(primary)



From this state, we restarted the OS of node # 2.
rs 01 and rs 02 of node # 1 were promoted to primary. rs01, rs02 of node # 2 demoted to secondary.I confirmed it from the log.



However, it happened that more connections would take more than 1 to 2 hours from OS reboot on node # 2 to expire.
And the MongoDB connection pool of the server of the web site became MAX and it became not connected to MongoDB from the web site.
Normally it will be out of connection in about 30 minutes at the longest.
I thought that node # 1 works as Primary, so I thought it would work normally, but I do not know why the connection is not disconnected for a long time.



If you encounter similar events, please let me know if anyone knows the solution or workaround.










share|improve this question













I am building a system that outputs information such as visit information and page transition of the user who visited the website to MongoDB,
The MongoDB connection pool of the server of the web site became MAX and it ceased to MongoDB from the web site.



The MongoDB service is configured with the following configuration.



mongos server#1 service:mongos、config
mongos server#2 service:mongos、config、rs01arbiter
mongos server#3 service:mongos、config、rs02arbiter
node#1 service:rs01(secondary)、rs02(secondary)
node#2 service:rs01(primary)、rs02(primary)



※Originally the following state is set, but OS is restarted, primary has dropped to node # 2, but it is left as it is
node#1 service:rs01(primary)、rs02(secondary)
node#2 service:rs01(secondary)、rs02(primary)



From this state, we restarted the OS of node # 2.
rs 01 and rs 02 of node # 1 were promoted to primary. rs01, rs02 of node # 2 demoted to secondary.I confirmed it from the log.



However, it happened that more connections would take more than 1 to 2 hours from OS reboot on node # 2 to expire.
And the MongoDB connection pool of the server of the web site became MAX and it became not connected to MongoDB from the web site.
Normally it will be out of connection in about 30 minutes at the longest.
I thought that node # 1 works as Primary, so I thought it would work normally, but I do not know why the connection is not disconnected for a long time.



If you encounter similar events, please let me know if anyone knows the solution or workaround.







mongodb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 8 at 4:45









m.kawasaki

1




1












  • It would be helpful to specify the mongoDB version. Also check if you are using keepAlive on the connection. What is your connection pool setting?
    – Akrion
    Nov 8 at 5:00










  • Thanks for the advice. The version of MongoDB is "MongoDB 3.0.12". The application connected to MongoDB is built with .net c # and is running on Windows Server 2012 R2. TCP Keepalive remains the default setting. Also when connecting from application socketOptions.keepAlive has not changed. The connectionString of the application also does not set the option as follows. <add name="config" connectionString="mongodb://user:pass@mongos1:27017,mongos2:27017,mongos3:27017/config"/>
    – m.kawasaki
    Nov 8 at 5:25










  • What is the default setting for keepAlive on that mongoDB version? Can you try to disable it? I assume your connection pool is 5 if using the node mongoDB driver etc.
    – Akrion
    Nov 8 at 5:30










  • I examined KeepAlive, but it was not found in ConnectionString's Option, nor was it found on the source code of MongoDB.Driver.dll (version 1.10.0.62). How do I know if you are using KeepAlive or not?
    – m.kawasaki
    Nov 9 at 2:11










  • From the connection source application, I am connecting to MongoDB with the C # .NET driver (MongoDB.Driver.dll (version 1.10.0.62)).
    – m.kawasaki
    Nov 9 at 2:42


















  • It would be helpful to specify the mongoDB version. Also check if you are using keepAlive on the connection. What is your connection pool setting?
    – Akrion
    Nov 8 at 5:00










  • Thanks for the advice. The version of MongoDB is "MongoDB 3.0.12". The application connected to MongoDB is built with .net c # and is running on Windows Server 2012 R2. TCP Keepalive remains the default setting. Also when connecting from application socketOptions.keepAlive has not changed. The connectionString of the application also does not set the option as follows. <add name="config" connectionString="mongodb://user:pass@mongos1:27017,mongos2:27017,mongos3:27017/config"/>
    – m.kawasaki
    Nov 8 at 5:25










  • What is the default setting for keepAlive on that mongoDB version? Can you try to disable it? I assume your connection pool is 5 if using the node mongoDB driver etc.
    – Akrion
    Nov 8 at 5:30










  • I examined KeepAlive, but it was not found in ConnectionString's Option, nor was it found on the source code of MongoDB.Driver.dll (version 1.10.0.62). How do I know if you are using KeepAlive or not?
    – m.kawasaki
    Nov 9 at 2:11










  • From the connection source application, I am connecting to MongoDB with the C # .NET driver (MongoDB.Driver.dll (version 1.10.0.62)).
    – m.kawasaki
    Nov 9 at 2:42
















It would be helpful to specify the mongoDB version. Also check if you are using keepAlive on the connection. What is your connection pool setting?
– Akrion
Nov 8 at 5:00




It would be helpful to specify the mongoDB version. Also check if you are using keepAlive on the connection. What is your connection pool setting?
– Akrion
Nov 8 at 5:00












Thanks for the advice. The version of MongoDB is "MongoDB 3.0.12". The application connected to MongoDB is built with .net c # and is running on Windows Server 2012 R2. TCP Keepalive remains the default setting. Also when connecting from application socketOptions.keepAlive has not changed. The connectionString of the application also does not set the option as follows. <add name="config" connectionString="mongodb://user:pass@mongos1:27017,mongos2:27017,mongos3:27017/config"/>
– m.kawasaki
Nov 8 at 5:25




Thanks for the advice. The version of MongoDB is "MongoDB 3.0.12". The application connected to MongoDB is built with .net c # and is running on Windows Server 2012 R2. TCP Keepalive remains the default setting. Also when connecting from application socketOptions.keepAlive has not changed. The connectionString of the application also does not set the option as follows. <add name="config" connectionString="mongodb://user:pass@mongos1:27017,mongos2:27017,mongos3:27017/config"/>
– m.kawasaki
Nov 8 at 5:25












What is the default setting for keepAlive on that mongoDB version? Can you try to disable it? I assume your connection pool is 5 if using the node mongoDB driver etc.
– Akrion
Nov 8 at 5:30




What is the default setting for keepAlive on that mongoDB version? Can you try to disable it? I assume your connection pool is 5 if using the node mongoDB driver etc.
– Akrion
Nov 8 at 5:30












I examined KeepAlive, but it was not found in ConnectionString's Option, nor was it found on the source code of MongoDB.Driver.dll (version 1.10.0.62). How do I know if you are using KeepAlive or not?
– m.kawasaki
Nov 9 at 2:11




I examined KeepAlive, but it was not found in ConnectionString's Option, nor was it found on the source code of MongoDB.Driver.dll (version 1.10.0.62). How do I know if you are using KeepAlive or not?
– m.kawasaki
Nov 9 at 2:11












From the connection source application, I am connecting to MongoDB with the C # .NET driver (MongoDB.Driver.dll (version 1.10.0.62)).
– m.kawasaki
Nov 9 at 2:42




From the connection source application, I am connecting to MongoDB with the C # .NET driver (MongoDB.Driver.dll (version 1.10.0.62)).
– m.kawasaki
Nov 9 at 2:42

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53201684%2fmongodb-the-connection-is-not-disconnected-for-a-long-time%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53201684%2fmongodb-the-connection-is-not-disconnected-for-a-long-time%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini