{"action":"closed","issue":{"url":"https://api.github.com/repos/akka/akka/issues/24357","repository_url":"https://api.github.com/repos/akka/akka","labels_url":"https://api.github.com/repos/akka/akka/issues/24357/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/24357/comments","events_url":"https://api.github.com/repos/akka/akka/issues/24357/events","html_url":"https://github.com/akka/akka/issues/24357","id":289943500,"number":24357,"title":"Misconfiguration of blocking IO dispatcher for akka streams","user":{"login":"nick-nachos","id":4942432,"avatar_url":"https://avatars3.githubusercontent.com/u/4942432?v=4","gravatar_id":"","url":"https://api.github.com/users/nick-nachos","html_url":"https://github.com/nick-nachos","followers_url":"https://api.github.com/users/nick-nachos/followers","following_url":"https://api.github.com/users/nick-nachos/following{/other_user}","gists_url":"https://api.github.com/users/nick-nachos/gists{/gist_id}","starred_url":"https://api.github.com/users/nick-nachos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nick-nachos/subscriptions","organizations_url":"https://api.github.com/users/nick-nachos/orgs","repos_url":"https://api.github.com/users/nick-nachos/repos","events_url":"https://api.github.com/users/nick-nachos/events{/privacy}","received_events_url":"https://api.github.com/users/nick-nachos/received_events","type":"User","site_admin":false},"labels":[{"id":92356850,"url":"https://api.github.com/repos/akka/akka/labels/3%20-%20in%20progress","name":"3 - in progress","color":"eb6420","default":false},{"id":92619677,"url":"https://api.github.com/repos/akka/akka/labels/bug","name":"bug","color":"e11d21","default":true},{"id":93144690,"url":"https://api.github.com/repos/akka/akka/labels/t:stream","name":"t:stream","color":"cccccc","default":false}],"state":"closed","locked":false,"assignee":{"login":"johanandren","id":666915,"avatar_url":"https://avatars3.githubusercontent.com/u/666915?v=4","gravatar_id":"","url":"https://api.github.com/users/johanandren","html_url":"https://github.com/johanandren","followers_url":"https://api.github.com/users/johanandren/followers","following_url":"https://api.github.com/users/johanandren/following{/other_user}","gists_url":"https://api.github.com/users/johanandren/gists{/gist_id}","starred_url":"https://api.github.com/users/johanandren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanandren/subscriptions","organizations_url":"https://api.github.com/users/johanandren/orgs","repos_url":"https://api.github.com/users/johanandren/repos","events_url":"https://api.github.com/users/johanandren/events{/privacy}","received_events_url":"https://api.github.com/users/johanandren/received_events","type":"User","site_admin":false},"assignees":[{"login":"johanandren","id":666915,"avatar_url":"https://avatars3.githubusercontent.com/u/666915?v=4","gravatar_id":"","url":"https://api.github.com/users/johanandren","html_url":"https://github.com/johanandren","followers_url":"https://api.github.com/users/johanandren/followers","following_url":"https://api.github.com/users/johanandren/following{/other_user}","gists_url":"https://api.github.com/users/johanandren/gists{/gist_id}","starred_url":"https://api.github.com/users/johanandren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanandren/subscriptions","organizations_url":"https://api.github.com/users/johanandren/orgs","repos_url":"https://api.github.com/users/johanandren/repos","events_url":"https://api.github.com/users/johanandren/events{/privacy}","received_events_url":"https://api.github.com/users/johanandren/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2018-01-19T11:21:33Z","updated_at":"2018-02-22T12:42:59Z","closed_at":"2018-02-22T12:42:59Z","author_association":"CONTRIBUTOR","body":"While working with akka streams API, I came across an issue when I used the following statement:\r\n```scala\r\nsomeSink.withAttributes(ActorAttributes.dispatcher(\"akka.stream.blocking-io-dispatcher\"))\r\n```\r\nThat call resulted to the following exception:\r\n\r\n```\r\nCaused by: com.typesafe.config.ConfigException$WrongType: reference.conf @ jar:file:/home/nnakas/.m2/repository/com/typesafe/akka/akka-stream_2.11/2.5.6/akka-stream_2.11-2.5.6.jar!/reference.conf: 80: akka.stream.blocking-io-dispatcher has type STRING rather than OBJECT\r\n\tat com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:159)\r\n\tat com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:170)\r\n\tat com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:176)\r\n\tat com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:176)\r\n\tat com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:184)\r\n\tat com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)\r\n\tat com.typesafe.config.impl.SimpleConfig.getObject(SimpleConfig.java:264)\r\n\tat com.typesafe.config.impl.SimpleConfig.getConfig(SimpleConfig.java:270)\r\n\tat com.typesafe.config.impl.SimpleConfig.getConfig(SimpleConfig.java:37)\r\n\tat akka.dispatch.Dispatchers.config(Dispatchers.scala:127)\r\n\tat akka.dispatch.Dispatchers.lookupConfigurator(Dispatchers.scala:96)\r\n\tat akka.dispatch.Dispatchers.lookup(Dispatchers.scala:79)\r\n\tat akka.actor.LocalActorRefProvider.actorOf(ActorRefProvider.scala:746)\r\n\t... 67 more\r\n```\r\n\r\nI went through the akka sources, and the configuration at reference.conf is as follows:\r\n\r\n```\r\n# Fully qualified config path which holds the dispatcher configuration\r\n# to be used by ActorMaterializer when creating Actors for IO operations,\r\n# such as FileSource, FileSink and others.\r\nblocking-io-dispatcher = \"akka.stream.default-blocking-io-dispatcher\"\r\n\r\ndefault-blocking-io-dispatcher {\r\n  type = \"Dispatcher\"\r\n  executor = \"thread-pool-executor\"\r\n  throughput = 1\r\n\r\n  thread-pool-executor {\r\n    fixed-pool-size = 16\r\n  }\r\n}\r\n```\r\n\r\nSo it would seem that the configuration should probably be like this:\r\n```\r\nblocking-io-dispatcher = ${akka.stream.default-blocking-io-dispatcher}\r\n```\r\n\r\nThis finding however made me wonder **why this error doesn't occur in the akka-stream library in general**. Theoretically, according to the [akka docs](https://doc.akka.io/docs/akka/current/stream/stream-io.html?language=scala#streaming-file-io):\r\n> If you want to configure a custom dispatcher for file IO operations globally, you can do so by changing the akka.stream.blocking-io-dispatcher\r\n\r\nso I went a little bit further with the research, and came across this inside `akka.stream.ActorAttributes`:\r\n```scala\r\nobject ActorAttributes {\r\n  import Attributes._\r\n  final case class Dispatcher(dispatcher: String) extends Attribute\r\n  final case class SupervisionStrategy(decider: Supervision.Decider) extends Attribute\r\n\r\n  val IODispatcher: Dispatcher = ActorAttributes.Dispatcher(\"akka.stream.default-blocking-io-dispatcher\")\r\n  // ...\r\n```\r\nThis effectively means that the stream IO dispatcher is fixed to the default one (i.e. `akka.stream.default-blocking-io-dispatcher`) and cannot be overridden via `akka.stream.blocking-io-dispatcher` setting, which is the reason however that the dispatcher resolution works in the first place (`default-blocking-io-dispatcher` is a valid Config object as demonstrated above)\r\n\r\nTo sum up, the issues that need to be tackled are as follows:\r\n1. Fix the resolution of the `akka.stream.blocking-io-dispatcher` property\r\n2. Use `akka.stream.blocking-io-dispatcher` instead of `akka.stream.default-blocking-io-dispatcher` within the akka-stream library.\r\n\r\nIf you approve of the issue and the suggested approach for fixing this, I'll be happy to PR the fix."}}
{"actor":{"display_login":"patriknw"}}