Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection dies after a significant amount of requests #8

Closed
cebe opened this issue Apr 16, 2015 · 1 comment
Closed

Connection dies after a significant amount of requests #8

cebe opened this issue Apr 16, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@cebe
Copy link
Member

cebe commented Apr 16, 2015

When inserting a massive amount of records the connection fails at some point when the system runs out of sockets:

Exception (Elasticsearch Database Exception) 'yii\elasticsearch\Exception' with message 'Elasticsearch request failed: 7 - Failed to connect to 192.168.178.50: Cannot assign requested address' 

in /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2-elasticsearch/Connection.php:376

Stack trace:
#0 /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2-elasticsearch/Connection.php(237): yii\elasticsearch\Connection->httpRequest('POST', Array, '{"version":"1.1...', false)
#1 /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2-elasticsearch/Command.php(138): yii\elasticsearch\Connection->post(Array, Array, '{"version":"1.1...')
#2 /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2-elasticsearch/ActiveRecord.php(434): yii\elasticsearch\Command->insert('yiiframework-de...', 'api-type', Array, NULL, Array)
#3 /home/cebe/dev/yiisoft/yiiframework.com/models/ApiType.php(83): yii\elasticsearch\ActiveRecord->insert(false)
#4 /home/cebe/dev/yiisoft/yiiframework.com/commands/ApiController.php(159): app\models\ApiType::createRecord(Object(yii\apidoc\models\ClassDoc), '1.1')
#5 /home/cebe/dev/yiisoft/yiiframework.com/vendor/igorw/retry/src/retry.php(11): app\commands\ApiController->app\commands\{closure}()
#6 /home/cebe/dev/yiisoft/yiiframework.com/commands/ApiController.php(165): igorw\retry(3, Object(Closure))
#7 /home/cebe/dev/yiisoft/yiiframework.com/commands/ApiController.php(74): app\commands\ApiController->populateElasticsearch1x(Array, '/home/cebe/dev/...')
#8 [internal function]: app\commands\ApiController->actionGenerate('1.1')
#9 /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array)
#10 /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#11 /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2/console/Controller.php(91): yii\base\Controller->runAction('', Array)
#12 /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2/base/Module.php(455): yii\console\Controller->runAction('', Array)
#13 /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2/console/Application.php(161): yii\base\Module->runAction('api', Array)
#14 /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2/console/Application.php(137): yii\console\Application->runAction('api', Array)
#15 /home/cebe/dev/yiisoft/yiiframework.com/vendor/yiisoft/yii2/base/Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))
#16 /home/cebe/dev/yiisoft/yiiframework.com/yii(27): yii\base\Application->run()
#17 {main}

http://elasticsearch-users.115913.n3.nabble.com/Failed-to-connect-to-127-0-0-1-Cannot-assign-requested-address-td4023793.html

You did not set the SO_REUSEADDR flag, so after "40k -50k documents", you have forced your
system to ran out of sockets. See also http://php.net/manual/de/function.socket-set-option.php

solution:

http://elasticsearch-users.115913.n3.nabble.com/Failed-to-connect-to-127-0-0-1-Cannot-assign-requested-address-tp4023793p4029385.html

@mrbig
Copy link

mrbig commented Sep 3, 2015

Had the same issue, using the dev release fixed it. Would be nice to see it in release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants