# Ривер и клиент

**URL:** <https://discuss.elastic.co/t/topic/27248>\
**Category:** Вопросы на русском языке\
**Created:** [August 12, 2015, 11:27am UTC](https://discuss.elastic.co/t/topic/27248 "2015-08-12T11:27:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![111](https://avatars.discourse-cdn.com/v4/letter/1/0ea827/32.png) [@111](https://discuss.elastic.co/u/111)\
**Post date:** [August 12, 2015, 11:27am UTC](https://discuss.elastic.co/t/topic/27248/1 "2015-08-12T11:27:52Z")

</div>

Добрый день!

Возникла проблема с ривером следующего рода: при отправке запроса типа PutMappingRequest (при существующем индексе) ривер виснет.

Пример кода:

```
public class ObjectsRiver extends AbstractRiverComponent implements River {

@Inject
public ObjectsRiver(RiverName riverName, RiverSettings settings,
		Client client, ThreadPool threadPool) {
	super(riverName, settings);
	client.admin()
			.indices()
			.putMapping(new PutMappingRequest("articles")
						.type("article")
						.source("{\"article\":{\"properties\":{\"id\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"text\":{\"type\":\"string\"}}}}"))
			.actionGet();
}
...
}

```

Дополнительные замечания:

1. В логах ничего нету.
2. При принудительной перезагрузке в логах может появиться сообщение об InterruptedException и о том, что программа не дождалась завершения операции.
3. Тестировалось на 1.4.3 и на 1.6.2.
4. Подобная проблема возникает и при запросах типа IndicesExistsRequest.

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [August 12, 2015, 2:54pm UTC](https://discuss.elastic.co/t/topic/27248/2 "2015-08-12T14:54:13Z")

</div>

А стек печатается с InterruptedException? Если да, то пришлите его сюда с полным сообщением об ошибке.

---

<div class="post-metadata">

**Author:** ![111](https://avatars.discourse-cdn.com/v4/letter/1/0ea827/32.png) [@111](https://discuss.elastic.co/u/111)\
**Post date:** [August 19, 2015, 12:03pm UTC](https://discuss.elastic.co/t/topic/27248/3 "2015-08-19T12:03:20Z")

</div>

Присылаю лог, начиная с момента запуска ривера и заканчивая принудительной остановкой ноды (замечу, что команда типа "POST /\_cluster/nodes/\_shutdown" не останавливает все потоки при зависнувшем ривере):

> [2015-08-19 14:49:49,718][INFO][cluster.metadata] [es1] [\_river] creating index, cause [auto(index api)], templates , s hards [1]/[1], mappings [river1]  
> [2015-08-19 14:49:49,973][INFO][cluster.metadata] [es1] [\_river] update\_mapping [river1] (dynamic)  
> [2015-08-19 14:49:50,909][INFO][river] [es1] rivers have been deprecated. Read [https://www.elastic.co/blog/dep](https://www.elastic.co/blog/dep) recating\_rivers  
> [2015-08-19 14:52:09,152][INFO][action.admin.cluster.node.shutdown] [es1] [cluster\_shutdown]: requested, shutting down in [1s]  
> [2015-08-19 14:52:10,154][INFO][action.admin.cluster.node.shutdown] [es1] [cluster\_shutdown]: done shutting down all nodes except master, proceeding to master  
> [2015-08-19 14:52:10,155][INFO][action.admin.cluster.node.shutdown] [es1] shutting down in [200ms]  
> [2015-08-19 14:52:10,357][INFO][action.admin.cluster.node.shutdown] [es1] initiating requested shutdown...  
> [2015-08-19 14:52:10,357][INFO][node] [es1] stopping ...  
> [2015-08-19 14:52:10,454][INFO][node] [es1] stopped  
> [2015-08-19 14:52:10,454][INFO][node] [es1] closing ...  
> [2015-08-19 14:52:20,459][INFO][node] [es1] closed

---

<div class="post-metadata">

**Author:** ![111](https://avatars.discourse-cdn.com/v4/letter/1/0ea827/32.png) [@111](https://discuss.elastic.co/u/111)\
**Post date:** [August 19, 2015, 12:03pm UTC](https://discuss.elastic.co/t/topic/27248/4 "2015-08-19T12:03:57Z")

</div>

> [2015-08-19 14:52:20,461][WARN][river] [es1] failed to create river [objects\_river][river1]  
> org.elasticsearch.common.inject.CreationException: Guice creation errors:

> 1. Error injecting constructor, org.elasticsearch.ElasticsearchIllegalStateException: Future got interrupted  
> at by.ias.es.rivers.ObjectsRiver.(Unknown Source)  
> while locating by.ias.es.rivers.ObjectsRiver  
> while locating org.elasticsearch.river.River

> 1 error  
> at org.elasticsearch.common.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:344)  
> at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:178)  
> at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:110)  
> at org.elasticsearch.common.inject.InjectorImpl.createChildInjector(InjectorImpl.java:131)  
> at org.elasticsearch.common.inject.ModulesBuilder.createChildInjector(ModulesBuilder.java:69)  
> at org.elasticsearch.river.RiversService.createRiver(RiversService.java:141)  
> at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:274)  
> at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:268)  
> at org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:113)  
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> at java.lang.Thread.run(Thread.java:745)  
> Caused by: org.elasticsearch.ElasticsearchIllegalStateException: Future got interrupted  
> at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:47)  
> at by.ias.es.rivers.ObjectsRiver.(ObjectsRiver.java:32)  
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)  
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
> at java.lang.reflect.Constructor.newInstance(Constructor.java:526)  
> at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:54)  
> at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)  
> at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)  
> at org.elasticsearch.common.inject.FactoryProxy.get(FactoryProxy.java:52)  
> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)  
> at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:837)  
> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)  
> at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:57)  
> at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)  
> at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:200)  
> at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:193)  
> at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:830)  
> at org.elasticsearch.common.inject.InjectorBuilder.loadEagerSingletons(InjectorBuilder.java:193)  
> at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:175)  
> ... 10 more  
> Caused by: java.lang.InterruptedException  
> at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:996)  
> at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1303)  
> at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:278)  
> at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:117)  
> at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:45)  
> ... 29 more

---

<div class="post-metadata">

**Author:** ![111](https://avatars.discourse-cdn.com/v4/letter/1/0ea827/32.png) [@111](https://discuss.elastic.co/u/111)\
**Post date:** [August 19, 2015, 12:05pm UTC](https://discuss.elastic.co/t/topic/27248/5 "2015-08-19T12:05:00Z")

</div>

> [2015-08-19 14:52:20,465][WARN][river] [es1] failed to write failed status for river creation  
> org.elasticsearch.common.inject.CreationException: Guice creation errors:

> 1. Error injecting constructor, org.elasticsearch.ElasticsearchIllegalStateException: Future got interrupted  
> at by.ias.es.rivers.ObjectsRiver.(Unknown Source)  
> while locating by.ias.es.rivers.ObjectsRiver  
> while locating org.elasticsearch.river.River

> 1 error  
> at org.elasticsearch.common.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:344)  
> at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:178)  
> at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:110)  
> at org.elasticsearch.common.inject.InjectorImpl.createChildInjector(InjectorImpl.java:131)  
> at org.elasticsearch.common.inject.ModulesBuilder.createChildInjector(ModulesBuilder.java:69)  
> at org.elasticsearch.river.RiversService.createRiver(RiversService.java:141)  
> at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:274)  
> at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:268)  
> at org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:113)  
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> at java.lang.Thread.run(Thread.java:745)  
> Caused by: org.elasticsearch.ElasticsearchIllegalStateException: Future got interrupted  
> at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:47)  
> at by.ias.es.rivers.ObjectsRiver.(ObjectsRiver.java:32)  
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)  
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
> at java.lang.reflect.Constructor.newInstance(Constructor.java:526)  
> at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:54)  
> at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)  
> at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)  
> at org.elasticsearch.common.inject.FactoryProxy.get(FactoryProxy.java:52)  
> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)  
> at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:837)  
> at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)  
> at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:57)  
> at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)  
> at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:200)  
> at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:193)  
> at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:830)  
> at org.elasticsearch.common.inject.InjectorBuilder.loadEagerSingletons(InjectorBuilder.java:193)  
> at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:175)  
> ... 10 more  
> Caused by: java.lang.InterruptedException  
> at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:996)  
> at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1303)  
> at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:278)  
> at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:117)  
> at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:45)  
> ... 29 more

(В нескольких сообщениях из-за ограничений на размер)

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [August 20, 2015, 8:24pm UTC](https://discuss.elastic.co/t/topic/27248/6 "2015-08-20T20:24:22Z")

</div>

А вы не пробовали эту операцию из конструктора в start() перенести? Так же виснет? Вообще в 2.0 ривер убрали. Так что если вы новое приложение разрабатываете, то я бы не рекомендовал с ними связываться.

---

<div class="post-metadata">

**Author:** ![111](https://avatars.discourse-cdn.com/v4/letter/1/0ea827/32.png) [@111](https://discuss.elastic.co/u/111)\
**Post date:** [August 21, 2015, 7:03am UTC](https://discuss.elastic.co/t/topic/27248/7 "2015-08-21T07:03:22Z")

</div>

Пробовал, не помогло. Спасибо за предложение.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:51pm UTC](https://discuss.elastic.co/t/topic/27248/8 "2017-07-06T13:51:23Z")

</div>

Closed on July 6, 2017, 1:51pm UTC


