Giter Site home page Giter Site logo

twitter / finagle Goto Github PK

View Code? Open in Web Editor NEW
8.8K 557.0 1.4K 102.47 MB

A fault tolerant, protocol-agnostic RPC system

Home Page: https://twitter.github.io/finagle

License: Apache License 2.0

Scala 95.12% Thrift 0.24% Java 2.95% Shell 0.07% Ruby 0.30% HTML 0.08% Lua 0.18% R 0.05% Starlark 1.01%
rpc distributed-systems finagle http http2 thrift mysql memcached redis zipkin

finagle's People

Contributors

atollena avatar bierbaum avatar blackicewei avatar bmatheny avatar cacoco avatar dotordogh avatar edma2 avatar enbnt avatar hamdiallam avatar isabelmartin avatar jcrossley avatar johanoskarsson avatar joybestourous avatar jyanjing avatar kevinoliver avatar luciferous avatar mariusae avatar mccue avatar mosesn avatar nepthar avatar nshkrob avatar plaflamme avatar ryanoneill avatar sprsquish avatar stevegury avatar tigerlily-he avatar travisbrown avatar vkostyukov avatar xinxiang-twitter avatar yufangong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

finagle's Issues

Closable is not a member of com.twitter.util

everytime I try to compile the finagle-example project

i type 'sbt "project finagle-example" run' and while its trying to compile the first before the array of related errors is whats on the subject line

[error] /Users/XXXXXXXX/finagle/finagle-core/src/main/scala/com/twitter/finagle/util/CloseNotifier.scala:3: Closable is not a member of com.twitter.util
[error] import com.twitter.util.{Closable, Future, Promise, Return}
[error] ^

It seems to be done against Scala 2.7.7 tho in the config 2.8.1 is specified.

[disclaimer: i'm new to scala finagle and java as a whole]

how to use finagle-thrift

i saw
val service = ClientBuilder() .hosts(Seq(thriftServerAddr)) .codec(codec) .hostConnectionLimit(1) .build() val client = new B.ServiceToClient(service, new TBinaryProtocol.Factory())
in finagle-thrift/src/test/scala/com/twitter/finagle/thrift/FinagleClientThriftServerSpec.scala

but i cant find ServiceToClient in my thrftsub,how to gen ServiceToClient

thanks

NullPointerException on Server.close()

This error occurred in Finagle 3.0.0 in Scala 2.9.1.

There appears to be a race condition. I've only seen it once, but here's the relevant portion of the stack trace:

NullPointerException: null (ServerBuilder.scala:664)
com.twitter.finagle.builder.MkServer$$anon$5$$anonfun$close$1.apply(ServerBuilder.scala:665)
com.twitter.finagle.builder.MkServer$$anon$5$$anonfun$close$1.apply(ServerBuilder.scala:664)
scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:34)
scala.collection.mutable.ArrayOps.foreach(ArrayOps.scala:38)
com.twitter.finagle.builder.MkServer$$anon$5.close(ServerBuilder.scala:664)

Can't Compile finagle-zipkin

I wrote a build.sbt for finagle-zipkin and copied it into a new directory, but I'm having trouble compiling finagle-zipkin.

my build.sbt looks like:

organization := "com.tumblr"

name := "finagle-zipkin"

version := "1.0-SNAPSHOT"

scalaVersion := "2.9.1"

libraryDependencies ++= Seq("com.twitter" % "finagle-thrift" % "5.1.0",
                    "org.scala-tools.testing" %% "specs" % "1.6.9" % "test" withSources(),
                    "com.twitter" % "scrooge" % "3.0.1",
                    "com.twitter" %% "finagle-ostrich4" % "4.0.2",
                    "com.twitter" %% "util" % "3.0.0" excludeAll(
                     ExclusionRule(organization = "com.sun.jdmk"),
                     ExclusionRule(organization = "com.sun.jmx"),
                     ExclusionRule(organization = "javax.jms")
                     ))

resolvers += "Twitter Repo" at "http://maven.twttr.com/"

I tried scrooging the scribe.thrift file, and moving the generated scala files to my sources dir, but I'm being told:

[error] finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/RawZipkinTracer.scala:78: type ServiceToClient is not a member of object com.twitter.finagle.zipkin.thrift.scribe
[error]   private[thrift] var client: scribe.ServiceToClient = null
[error]                                      ^
[error] finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/RawZipkinTracer.scala:89: type ServiceToClient is not a member of object com.twitter.finagle.zipkin.thrift.scribe
[error]       client = new scribe.ServiceToClient(new TracelessFilter andThen transport,
[error]                           ^
[error] finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/RawZipkinTracer.scala:120: trait LogEntry is abstract; cannot be instantiated
[error]       msgs = msgs :+ new LogEntry().setCategory(TraceCategory).setMessage(serializedBase64Span)
[error]                      ^
[error] three errors found
[error] {file:finagle-zipkin/}default-8c208a/compile:compile: Compilation failed
[error] Total time: 5 s, completed Jun 28, 2012 2:44:13 PM

If I try thrift to java instead, I get:

[error] finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/RawZipkinTracer.scala:78: type ServiceToClient is not a member of object com.twitter.finagle.zipkin.thrift.scribe
[error]   private[thrift] var client: scribe.ServiceToClient = null
[error]                                      ^
[error] finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/RawZipkinTracer.scala:89: type ServiceToClient is not a member of object com.twitter.finagle.zipkin.thrift.scribe
[error]       client = new scribe.ServiceToClient(new TracelessFilter andThen transport,
[error]                           ^
[error] two errors found
[error] {file:finagle-zipkin/}default-8c208a/compile:compile: Compilation failed

Should FailureAccrualFactory accrue failures for cancelled futures?

When using failureAccrualParams in the ClientBuilder, the FailureAccrualFactory that wraps the underlying factory accrues failures for futures that are canceled.

This probably isnt desirable for usage patterns where you are doing something like

val (first, rest) = Future.select(futures).get() 
rest.foreach(_.cancel)

I see there is a TODO in FaulureAccrualFactory to enhance this type of behavior, so just mentioning it as a case that should be handled.

Unable to use sbt script with fingale on master branch.

downloading sbt-launch.jar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1017k 100 1017k 0 0 99k 0 0:00:10 0:00:10 --:--:-- 95868
[info] Loading project definition from /Users/nirth/Documents/Dojos/Scala_1/finagle/project
[info] Updating {file:/Users/nirth/Documents/Dojos/Scala_1/finagle/project/}default-0647f5...
[info] Resolving com.twitter#sbt-package-dist;1.0.5 ...
[info] Resolving ivysvn#ivysvn;2.1.0 ...
[info] Resolving org.markdownj#markdownj;0.3.0-1.0.2b4 ...
[info] Resolving org.freemarker#freemarker;2.3.16 ...
[info] Resolving com.twitter#sbt-thrift2;0.0.1 ...
[info] Resolving org.scala-tools.sbt#sbt_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#main_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#actions_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#classfile_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#io_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#control_2.9.1;0.11.2 ...
[info] Resolving org.scala-lang#scala-library;2.9.1 ...
[info] Resolving org.scala-tools.sbt#interface;0.11.2 ...
[info] Resolving org.scala-tools.sbt#logging_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#process_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#classpath_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#launcher-interface_2.9.1;0.11.2 ...
[info] Resolving org.scala-lang#scala-compiler;2.9.1 ...
[info] Resolving org.scala-tools.sbt#incremental-compiler_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#collections_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#api_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#persist_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbinary#sbinary_2.9.0;0.4.0 ...
[info] Resolving org.scala-tools.sbt#compile_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#ivy_2.9.1;0.11.2 ...
[info] Resolving org.apache.ivy#ivy;2.2.0 ...
[info] Resolving com.jcraft#jsch;0.1.31 ...
[info] Resolving commons-httpclient#commons-httpclient;3.1 ...
[info] Resolving commons-logging#commons-logging;1.0.4 ...
[info] Resolving commons-codec#commons-codec;1.2 ...
[info] Resolving org.scala-tools.sbt#completion_2.9.1;0.11.2 ...
[info] Resolving jline#jline;0.9.94 ...
[info] Resolving org.scala-tools.sbt#run_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#task-system_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#tasks_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#tracking_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#cache_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#testing_2.9.1;0.11.2 ...
[info] Resolving org.scala-tools.testing#test-interface;0.5 ...
[info] Resolving org.scala-tools.sbt#compiler-interface;0.11.2 ...
[info] Resolving org.scala-tools.sbt#precompiled-2_8_1;0.11.2 ...
[info] Resolving org.scala-tools.sbt#precompiled-2_8_0;0.11.2 ...
[info] Resolving org.scala-tools.sbt#precompiled-2_9_0;0.11.2 ...
[info] downloading http://maven.twttr.com/com/twitter/sbt-thrift2_2.9.1_0.11.2/0.0.1/sbt-thrift2-0.0.1.jar ...
[warn] [FAILED ] com.twitter#sbt-thrift2;0.0.1!sbt-thrift2.jar: Downloaded file size doesn't match expected Content Length for http://maven.twttr.com/com/twitter/sbt-thrift2_2.9.1_0.11.2/0.0.1/sbt-thrift2-0.0.1.jar. Please retry. (36496ms)
[warn] [FAILED ] com.twitter#sbt-thrift2;0.0.1!sbt-thrift2.jar: Downloaded file size doesn't match expected Content Length for http://maven.twttr.com/com/twitter/sbt-thrift2_2.9.1_0.11.2/0.0.1/sbt-thrift2-0.0.1.jar. Please retry. (36496ms)
[warn] ==== twitter.com: tried
[warn] http://maven.twttr.com/com/twitter/sbt-thrift2_2.9.1_0.11.2/0.0.1/sbt-thrift2-0.0.1.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.twitter#sbt-thrift2;0.0.1!sbt-thrift2.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/nirth/Documents/Dojos/Scala_1/finagle/project/}default-0647f5/*:update: sbt.ResolveException: download failed: com.twitter#sbt-thrift2;0.0.1!sbt-thrift2.jar

TLS verification not catching badly signed certificates

I've run into an issue with TLS enabled clients. I'm building a service that will hit a remote host with a POST request and I want to make sure the remote host is on TLS and has a valid certificate. I'm using the following code to send my request:

val uri = "https://www.ribe.me/submit.php"
val address = new URI(uri)

val client = ClientBuilder()
  .codec(Http())
  .tls()
  .hosts(new InetSocketAddress(address.getHost, 443))
  // ... set some other variables about timeouts
  .build()

val request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uri) // And set the content and headers

HttpHeaders.setHost(request, address.getHost)

client(request)

The uri here is a test script running on an Apache server and is signed (as you can see if you visit it in Chrome) with a MediaTemple SSL certificate whose domain doesn't match the URI domain. This, I believe, should cause a SSLException to be thrown since the certificate should fail verification, but instead my program is happily sending the requests off without issue and returning 200 - OK every time.

Either there is a bad behavior here on Finagle's part or I've messed up something non-obvious in the code...

com.twitter.finagle.util.Timer is private

In the readme there are 2 examples where

 import com.twitter.finagle.util.Timer._

is used. However, that object is private[finagle], so if you actually try to use the example code, it wont build.

Can it be public? Had to fall back to using a JavaTimer instead.

HttpDechunker sends EOF before response is finished

In some cases, HttpDechunker sends an EOF before it has finished writing the all chunks to StreamResponse#messages. This is because in HttpDechunker.scala#L39, when chunk.readable is false, the sendOf offer is set to Offer.const(()). In L43, this offer is synchronized on in order to send EOF message only after it's finished. However, when chunk.readable is false, an EOF is sent immediately irrespective of any other chunks that haven't been read.

Loading 2.0.1 binaries with SBT 0.11.2 and Scala 2.9.1 Fails

I've created an empty SBT project that lists finagle as a library dependency, pulling from maven.twttr.com; sbt compile fails with the following abbreviated output:

[info] Loading project definition from /Users/ben/scala/test/project
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.codahale#jerkson_2.8.1;0.1.4: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/ben/scala/test/}default-c49c40/*:update: sbt.ResolveException: unresolved dependency: com.codahale#jerkson_2.8.1;0.1.4: not found
[error] Total time: 4 s, completed Mar 6, 2012 12:26:08 AM

It seems that finagle-exception hardcodes a dependency on jerkson_2.8.1 in the 2.9.1 repo, which cannot be resolved.

Though it doesn't appear in the above output, this also applies to thrift 0.5.0; I've worked around that with some hackery in libraryDependencies.

why don't build finagle

First,I install sbt from brew.
build failใ€‚ใ€‚ใ€‚
like this friend issues #61

I install sbt 0.7.5 and 0.7.7...
build failใ€‚ใ€‚ใ€‚

1 #Project properties
2 #Mon Feb 13 16:19:06 PST 2012
3 project.organization=com.twitter
4 project.name=finagle
5 sbt.version=0.7.7
6 project.version=1.11.1-SNAPSHOT
7 build.scala.versions=2.9.1
8 project.initialize=false

message๏ผš
org.scala-tools.testing#specs_2.9.1;1.6.8: not found

i must install scale later 2.9.1?

ZRevRangeByScore's min and max are backwards

problem

ZRevRangeByScore extends ZScoredRange in https://github.com/twitter/finagle/blob/master/finagle-redis/src/main/scala/com/twitter/finagle/redis/protocol/commands/SortedSets.scala but ZRevRangeByScore has a different order of arguments than ZRangeByScore. ZRevRangeByScore goes key max min [WITHSCORES] [LIMIT offset count] whereas ZRangeByScore goes key min max [WITHSCORES] [LIMIT offset count]. ZScoredRange is always min then max, which leads to shenanigans where you call client.zRevRangeByScore("key", 3, 0) and it sends to redis ZREVRANGEBYSCORE "key" 0 3.

solution

add an abstract method to the trait which forces the implementor to specify the order of min and max.

tag your commits please

there is no tags since 1.2.3 version for downloading.
i saw 1.9.2 in twitter repo.

it will be very nice if you would tag commits before deploying builds to repo.

current situation with Download option at github of this project is very confusing for any new customer.
last tagged version even can't be built with sbt 0.7.4 cause xsbti.Logger NotFound exception occur.

thank you.

java.lang.NoSuchMethodError: scala.collection.mutable.Queue$.apply(Lscala/collection/Seq;)Lscala/collection/mutable/Queue;

libraryDependencies += "com.twitter" % "finagle" % "3.0.0"

when execute build
val client = ClientBuilder().codec(Http.get).hosts(address).hostConnectionLimit(1).build();

Exception in thread "main" java.lang.NoSuchMethodError: scala.collection.mutable.Queue$.apply(Lscala/collection/Seq;)Lscala/collection/mutable/Queue;
at com.twitter.finagle.builder.Cluster$$anon$1$$anonfun$1$$anonfun$2.apply(Cluster.scala:32)
at com.twitter.finagle.builder.Cluster$$anon$1$$anonfun$1$$anonfun$2.apply(Cluster.scala:32)
at scala.collection.mutable.MapLike$class.getOrElseUpdate(MapLike.scala:176)
at scala.collection.mutable.HashMap.getOrElseUpdate(HashMap.scala:45)
at com.twitter.finagle.builder.Cluster$$anon$1$$anonfun$1.apply(Cluster.scala:32)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:76)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:233)
at scala.collection.immutable.List.map(List.scala:76)
at com.twitter.finagle.builder.Cluster$$anon$1.snap(Cluster.scala:31)
at com.twitter.finagle.loadbalancer.HeapBalancer.(HeapBalancer.scala:50)
at com.twitter.finagle.builder.ClientBuilder$$anon$1.(ClientBuilder.scala:749)
at com.twitter.finagle.builder.ClientBuilder.internalBuildFactory(ClientBuilder.scala:749)
at com.twitter.finagle.builder.ClientBuilder.build(ClientBuilder.scala:785)
at com.qileke.finagle.basic.SimpleHttpClient$.main(SimpleHttpClient.scala:25)
at com.qileke.finagle.basic.SimpleHttpClient.main(SimpleHttpClient.scala)

ServerBuilder order wrong in README

The README (and possibly other docs?) list...

val server: Server[HttpRequest, HttpResponse] = ServerBuilder() // 4
.codec(Http)
.bindTo(address)
.build(service)
.name("HttpServer"));

The build needs to be the last step or the compiler vomits out an unhelpful...

Cannot prove that com.twitter.finagle.builder.ServerConfig[org.jboss.netty.handler.codec.http.HttpRequest,org.jboss.netty.handler.codec.http.HttpResponse,com.twitter.finagle.builder.ServerConfig.Yes,com.twitter.finagle.builder.ServerConfig.Yes,Nothing] =:= com.twitter.finagle.builder.ServerConfig[org.jboss.netty.handler.codec.http.HttpRequest,org.jboss.netty.handler.codec.http.HttpResponse,com.twitter.finagle.builder.ServerConfig.Yes,com.twitter.finagle.builder.ServerConfig.Yes,com.twitter.finagle.builder.ServerConfig.Yes]

compile error

I did as the following commands, but got the compile errors.
==>git clone https://github.com/twitter/finagle.git
==>cd finagle && ./sbt update compile

[error] /Users/zhang/Projects/scala/finagle/finagle-core/src/main/scala/com/twitter/finagle/dispatch/ClientDispatcher.scala:3: AsyncQueue is not a member of com.twitter.concurrent
[error] import com.twitter.concurrent.AsyncQueue
[error] ^
[error] /Users/zhang/Projects/scala/finagle/finagle-core/src/main/scala/com/twitter/finagle/dispatch/ClientDispatcher.scala:16: not found: type AsyncQueue
[error] private[this] val dispatchq = new AsyncQueue[(Req, Promise[Rep])]
[error] ^
[error] /Users/zhang/Projects/scala/finagle/finagle-core/src/main/scala/com/twitter/finagle/transport/ChannelTransport.scala:3: AsyncQueue is not a member of com.twitter.concurrent
[error] import com.twitter.concurrent.AsyncQueue
[error] ^
[error] /Users/zhang/Projects/scala/finagle/finagle-core/src/main/scala/com/twitter/finagle/transport/ChannelTransport.scala:21: not found: type AsyncQueue
[error] private[this] val readq = new AsyncQueue[Out]
[error] ^

I find the AsyncQueue class at
https://github.com/twitter/util/blob/master/util-core/src/main/scala/com/twitter/concurrent/AsyncQueue.scala

What should I do to solve the problem or I downed the wrong branch?

Last 8kb of StreamResponse is sometimes lost

HttpChunker.scala uses Offer#select to select between StreamResponse#messages and StreamResponse#error. Offer#select utilizes Offer#choose which, according to the documents, chooses between immediately synchronizable offers by randomly picking one.

In some cases--particularly when a StreamResponse from a fast server to a slower client--messages and error are both synchronizable at the same time. When this occurs, about half the time HttpChunker closes the connection and discards the last ChannelBuffer waiting in messages, and we lose the last chunk of data.

java.lang.NoSuchMethodError: scala.runtime.RichLong.compare(J)I

i create a project following the link: http://www.fisharefriends.us/blog/2011-09-21-scala-plus-sbt-plus-finagle-plus-scalatest-plus-spring/, but i modify the version of sbt and scala, the version of sbt is 0.11.2 and the version of scala is 2.9.1.

I run the compile command in sbt, it works fine, and i run the 'run' EchoServer command in the sbt, it works fine too.

but i run the EchoClient, it throws an exception: java.lang.NoSuchMethodError: scala.runtime.RichLong.compare(J)I

java.lang.NoSuchMethodError: scala.runtime.RichLong.compare(J)I
at com.twitter.util.Duration.compare(Time.scala:350)
at com.twitter.util.Duration.compare(Time.scala:317)
at scala.math.Ordered$class.$greater(Ordered.scala:46)
at com.twitter.util.Duration.$greater(Time.scala:317)
at com.twitter.finagle.builder.ClientBuilder.com$twitter$finagle$builder$ClientBuilder$$buildPool(ClientBuilder
scala:619)
at com.twitter.finagle.builder.ClientBuilder$$anonfun$12.apply(ClientBuilder.scala:703)
at com.twitter.finagle.builder.ClientBuilder$$anonfun$12.apply(ClientBuilder.scala:681)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
at scala.collection.immutable.List.map(List.scala:45)
at com.twitter.finagle.builder.SocketAddressCluster.mkFactories(Cluster.scala:49)
at com.twitter.finagle.builder.ClientBuilder.internalBuildFactory(ClientBuilder.scala:681)
at com.twitter.finagle.builder.ClientBuilder.build(ClientBuilder.scala:789)
at EchoClient$.main(EchoExample.scala:25)
at EchoClient.main(EchoExample.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

Getting unresolved dependency from maven.twttr.com

[info] Resolving thrift#libthrift;0.5.0 ...
[warn]  module not found: thrift#libthrift;0.5.0
[warn] ==== local: tried
[warn]   /Users/devin/.ivy2/local/thrift/libthrift/0.5.0/ivys/ivy.xml
[warn] ==== twitter-repo: tried
[warn]   http://maven.twttr.com/thrift/libthrift/0.5.0/libthrift-0.5.0.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/thrift/libthrift/0.5.0/libthrift-0.5.0.pom
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn]   http://scala-tools.org/repo-releases/thrift/libthrift/0.5.0/libthrift-0.5.0.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: thrift#libthrift;0.5.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

Closing a service using defaultChannelFactory is not idempotent - ReferenceCountedChannelFactory

the com.twitter.finagle.builder.ServerBuilder object shares an defaultChannelFactory of type ReferenceCountedChannelFactory.

When ReferenceCountedChannelFactory is closed (via the releaseExternalResources() method), the refcount is deprecated and if it is less than 1 then the underlying resource's releaseExternalResources() is called.

The problem is that this requires each server to have close called once and once only. If any client calls close more than the number of servers open + 1, then all servers are closed.

consistent TooManyConcurrentRequestsException(s)

Hi-

I am using finagle to build a proxy service, using the http codec. It seems to work fine, but once under load produces these kind of stack traces. Any tips or pointers to what could be going wrong/how to fix?

All the samples seem to call Service.release() as they exit. Is there a need to call it on a request basis?

2011-06-28T22:37:39+00:00 com.twitter.finagle.TooManyConcurrentRequestsException
2011-06-28T22:37:39+00:00 at com.twitter.finagle.channel.ChannelService.apply(ChannelService.scala:92)
2011-06-28T22:37:39+00:00 at com.twitter.finagle.service.ExpiringService.apply(ExpiringService.scala:80)
2011-06-28T22:37:39+00:00 at com.twitter.finagle.ServiceProxy.apply(Service.scala:69)
2011-06-28T22:37:39+00:00 at com.twitter.finagle.ServiceProxy.apply(Service.scala:69)
2011-06-28T22:37:39+00:00 at com.twitter.finagle.service.FailureAccrualFactory$$anonfun$make$1$$anon$1.apply(FailureAccrualFactory.scala:37)
2011-06-28T22:37:39+00:00 at com.twitter.finagle.service.RefcountedService.apply(RefcountedService.scala:13)
2011-06-28T22:37:39+00:00 at com.twitter.finagle.service.StatsFilter.apply(StatsFilter.scala:24)
2011-06-28T22:37:39+00:00 at com.twitter.finagle.Filter$$anon$5.apply(Service.scala:182)
2011-06-28T22:37:39+00:00 at com.twitter.finagle.loadbalancer.LeastQueuedStrategy$$anon$1$$anonfun$make$1$$anon$2.apply(LeastQueuedStrategy.scala:55)
2011-06-28T22:37:39+00:00 at com.twitter.finagle.FactoryToService$$anonfun$apply$2.apply(Service.scala:115)
2011-06-28T22:37:39+00:00 at com.twitter.finagle.FactoryToService$$anonfun$apply$2.apply(Service.scala:114)
2011-06-28T22:37:39+00:00 at com.twitter.util.Promise$$anon$2$$anonfun$8.apply(Future.scala:604)
2011-06-28T22:37:39+00:00 at com.twitter.util.Promise$$anon$2$$anonfun$8.apply(Future.scala:601)
2011-06-28T22:37:39+00:00 at com.twitter.util.Promise.respond(Future.scala:559)
2011-06-28T22:37:39+00:00 at com.twitter.util.Promise$$anon$2.(Future.scala:601)
2011-06-28T22:37:39+00:00 at com.twitter.util.Promise.flatMap(Future.scala:599)

Thanks!

Finagle does not build with SBT 0.11.x+

The latest checkout of Finagle that I have (3892b93) does not build on MacOS X + Homebrew installed SBT. I could reproduce this on 2 different machines.

A dependency cannot be found, here is the full output:

$ sbt update test
Getting net.java.dev.jna jna 3.2.3 ...
:: retrieving :: org.scala-tools.sbt#boot-app
    confs: [default]
    1 artifacts copied, 0 already retrieved (838kB/14ms)
Getting Scala 2.9.1 (for sbt)...
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.9.1/scala-compiler-2.9.1.jar ...
    [SUCCESSFUL ] org.scala-lang#scala-compiler;2.9.1!scala-compiler.jar (41421ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.9.1/scala-library-2.9.1.jar ...
    [SUCCESSFUL ] org.scala-lang#scala-library;2.9.1!scala-library.jar (32902ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/jline/2.9.1/jline-2.9.1.jar ...
    [SUCCESSFUL ] org.scala-lang#jline;2.9.1!jline.jar (1559ms)
downloading http://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.4/jansi-1.4.jar ...
    [SUCCESSFUL ] org.fusesource.jansi#jansi;1.4!jansi.jar (1663ms)
:: retrieving :: org.scala-tools.sbt#boot-scala
    confs: [default]
    4 artifacts copied, 0 already retrieved (19939kB/54ms)
Getting org.scala-tools.sbt sbt_2.9.1 0.7.5 ...

:: problems summary ::
:::: WARNINGS
        module not found: org.scala-tools.sbt#sbt_2.9.1;0.7.5

    ==== local: tried

      /Users/jponge/.ivy2/local/org.scala-tools.sbt/sbt_2.9.1/0.7.5/ivys/ivy.xml

    ==== typesafe-ivy-releases: tried

      http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.9.1/0.7.5/ivys/ivy.xml

    ==== Maven Central: tried

      http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt_2.9.1/0.7.5/sbt_2.9.1-0.7.5.pom

    ==== Scala-Tools Maven2 Repository: tried

      http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt_2.9.1/0.7.5/sbt_2.9.1-0.7.5.pom

    ==== Scala-Tools Maven2 Snapshots Repository: tried

      http://scala-tools.org/repo-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.7.5/sbt_2.9.1-0.7.5.pom

        ::::::::::::::::::::::::::::::::::::::::::::::

        ::          UNRESOLVED DEPENDENCIES         ::

        ::::::::::::::::::::::::::::::::::::::::::::::

        :: org.scala-tools.sbt#sbt_2.9.1;0.7.5: not found

        ::::::::::::::::::::::::::::::::::::::::::::::



:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-tools.sbt#sbt_2.9.1;0.7.5: not found
Error during sbt execution: Error retrieving required libraries
  (see /Users/jponge/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.7.5

make the cause of WriteException accessable

Would be nice to have access so that you could for instance supress logging of WriteExteptions with expected causes like CancelledRequestexception CancelledConnectionExcetpion, etc...

How to use Finagle for Proxy? I encountered a problem. Options

There are my test codes. A simple proxy example:

EchoServer:

object EchoServer {

def main(args: Array[String]) {

val service = new Service[String, String] {
  def apply(request: String) = {
    println("I'm server,I received request message:" + request)
    Future.value("I'm server. Where are you from?")
  }
}

val server: Server = ServerBuilder()
  .codec(StringCodec)
  .bindTo(new InetSocketAddress(8082))
  .name("Server")
  .build(service)

}
}

EchoRouter:

object EchoRouter {

def main(args: Array[String]) {

val client: Service[String, String] = ClientBuilder()
  .codec(StringCodec)
  .hosts(new InetSocketAddress(8082))
  .hostConnectionLimit(1)
  .requestTimeout(Duration(1, TimeUnit.SECONDS))
  .retries(10)
  .build()

val proxyService = new Service[String, String] {
  def apply(request: String) = {
    println("I'm router, I received request message:" + request)
    client(request).onSuccess {
      result => println("Router received result asynchronously: " + result)
    } onFailure {
      error => error.printStackTrace()
    }
  }
}

val server: Server = ServerBuilder()
  .codec(StringCodec)
  .bindTo(new InetSocketAddress(8081))
  .name("Router")
  .build(proxyService)

}

}

EchoClient:

object EchoClient {

def main(args: Array[String]) {

val client: Service[String, String] = ClientBuilder()
  .codec(StringCodec)
  .hosts(new InetSocketAddress(8081))
  .hostConnectionLimit(1)
  .requestTimeout(Duration(1, TimeUnit.SECONDS))
  .retries(10)
  .build()

client("Hi,I'm client.\n").onSuccess {
  result => println("Client received result asynchronously: " + result)
} onFailure {
  error => error.printStackTrace()
} ensure {
  client.release()
}

}
}

The problem is the EchoRouter can receive the message, But the EchoServer can't receive the message .

Is there any mistake i made? Can someone help me?

Here are version information.
scala version : 2.9.1
finagle-core_2.9.1 version:1.11.1

build is failing

I cloned the project and ran ./sbt test. It gives following error

[error] /Users/pankajmittal/firestorm/finagle/project/Build.scala:3: object twitter is not a member of package com
[error] import com.twitter.sbt._
[error] ^
[error] one error found

Closing a Finagle service leaves live, non-daemon threads

Starting a Finagle client using ClientBuilder (and the ServiceToClient Thrift generation in this case), using it, and then closing it down will cause the process to stay alive, probably because of non-daemon threads opened by Finagle. Attaching a stack from after calling close on the Service underlying the ServiceToClient object.

Thanks!

finagle or netty gets into a bad state

Not sure if this is finagle, netty or user error.

On and off I have seen my processes get into a state where they start logging this message every second, which happens to be the tcpConnectTimeout of the clients used. I have 4 copies of the process up and only one gets into this state. If I restart the proc, I dont see the logging any more. Is this some kind of known issue?

            WAR [20110727-18:20:22.235] channel: java.net.ConnectException: connection timed out
    WAR [20110727-18:20:22.235] channel:     at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processConnectTimeout(NioClientSocketPipelineSink.java:371)
    WAR [20110727-18:20:22.235] channel:     at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:283)
    WAR [20110727-18:20:22.235] channel:     at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
    WAR [20110727-18:20:22.235] channel:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    WAR [20110727-18:20:22.235] channel:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    WAR [20110727-18:20:22.235] channel:     at java.lang.Thread.run(Thread.java:636)
    WAR [20110727-18:20:23.235] channel: EXCEPTION, please implement com.twitter.finagle.http.ClientConnectionManager.exceptionCaught() for proper handling.
    WAR [20110727-18:20:23.235] channel: java.net.ConnectException: connection timed out
    WAR [20110727-18:20:23.235] channel:     at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processConnectTimeout(NioClientSocketPipelineSink.java:371)
    WAR [20110727-18:20:23.235] channel:     at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:283)
    WAR [20110727-18:20:23.235] channel:     at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
    WAR [20110727-18:20:23.235] channel:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    WAR [20110727-18:20:23.755] channel: EXCEPTION, please implement com.twitter.finagle.http.ClientConnectionManager.exceptionCaught() for proper handling.

HTTPS keepalive broken for finagle http client? [with failing test case]

I'm trying to use the finagle-http client to connect to a HTTPS service that supports HTTP 1.1 keep-alive for persistent connections. The server I'm connecting to will terminate the connection after 60 seconds of inactivity. When it does this, I get the following error in my client's log:

DEB [20111130-02:14:19.999] ssl: Failed to clean up SSLEngine.
DEB [20111130-02:14:19.999] ssl: javax.net.ssl.SSLException: Inbound closed before receiving peer's close_notify: possible truncation attack?
DEB [20111130-02:14:19.999] ssl:     at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
DEB [20111130-02:14:19.999] ssl:     at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1429)
DEB [20111130-02:14:19.999] ssl:     at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1397)
DEB [20111130-02:14:19.999] ssl:     at com.sun.net.ssl.internal.ssl.SSLEngineImpl.closeInbound(SSLEngineImpl.java:1336)
DEB [20111130-02:14:19.999] ssl:     at org.jboss.netty.handler.ssl.SslHandler.channelDisconnected(SslHandler.java:468)
DEB [20111130-02:14:19.999] ssl:     at org.jboss.netty.channel.Channels.fireChannelDisconnected(Channels.java:360)
DEB [20111130-02:14:19.999] ssl:     at org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:593)
DEB [20111130-02:14:19.999] ssl:     at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:356)
DEB [20111130-02:14:19.999] ssl:     at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
DEB [20111130-02:14:19.999] ssl:     at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
DEB [20111130-02:14:19.999] ssl:     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
DEB [20111130-02:14:19.999] ssl:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
DEB [20111130-02:14:19.999] ssl:     at java.lang.Thread.run(Thread.java:662)

then, subsequent attempts to use the Service to make requests fail with the following error:

ERR [20111130-02:14:37.455] frontdoor: Error processing request
ERR [20111130-02:14:37.455] frontdoor: java.lang.IllegalArgumentException: Cannot change mode after SSL traffic has started
ERR [20111130-02:14:37.455] frontdoor:     at com.sun.net.ssl.internal.ssl.SSLEngineImpl.setUseClientMode(SSLEngineImpl.java:1728)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.builder.ClientBuilder$$anon$3$$anonfun$getPipeline$5.apply(ClientBuilder.scala:557)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.builder.ClientBuilder$$anon$3$$anonfun$getPipeline$5.apply(ClientBuilder.scala:556)
ERR [20111130-02:14:37.455] frontdoor:     at scala.Option.foreach(Option.scala:185)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.builder.ClientBuilder$$anon$3.getPipeline(ClientBuilder.scala:556)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.channel.ChannelServiceFactory$$anonfun$make$1.apply(ChannelService.scala:171)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.channel.ChannelServiceFactory$$anonfun$make$1.apply(ChannelService.scala:165)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.util.Try$.apply(Try.scala:13)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.util.Future$.apply(Future.scala:33)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.channel.ChannelServiceFactory.make(ChannelService.scala:165)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.pool.CachingPool.make(CachingPool.scala:55)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.pool.WatermarkPool.make(WatermarkPool.scala:100)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.service.FailureAccrualFactory.make(FailureAccrualFactory.scala:34)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.Filter$$anon$6.make(Service.scala:186)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.loadbalancer.HeapBalancer.make(HeapBalancer.scala:122)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.ServiceFactoryProxy.make(Service.scala:104)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.factory.RefcountedFactory.make(RefcountedFactory.scala:9)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.ServiceFactoryProxy.make(Service.scala:104)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.factory.StatsFactoryWrapper.make(StatsFactoryWrapper.scala:18)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.Filter$$anon$6.make(Service.scala:186)
ERR [20111130-02:14:37.455] frontdoor:     at com.twitter.finagle.FactoryToService.apply(Service.scala:113)
ERR [20111130-02:14:37.455] frontdoor:     (...more...)

This worked in Finagle 1.7.1, but we'd like to upgrade. I'm trying to write a test case but having difficultly setting up a server that closes the connection after a timeout.

ZookeeperServerSetCluster does not let us know when it is ready

see this thread: http://groups.google.com/group/finaglers/browse_thread/thread/ccba01b03e13072a

Basically, I can't get consistent client behavior when a client first starts up without knowing when discovery has taken place - or at least without the cluster blocking the client creation until discovery has finished.

I've had to duplicate the hack in https://github.com/twitter/finagle/blob/master/finagle-serversets/src/test/scala/com/twitter/finagle/zookeeper/ZookeeperServerSetClusterSpec.scala of grabbing the private thread and joining on it.

This is not good as it depends on some internals that may go away and is also very timing dependent. The thread may already have finished before my other thread comes along to join on it.

So yeah, either some method like awaitDiscovery() that blocks until discovery has completed or getNumberOfHosts() that returns the number of discovered hosts so I can block until that is > 1 would be great.

Thanks.

StreamResponse.release does not release client

Thus, if you simply proxy StreamResponses from a server to a service the client pool will become exhausted. This is different from the semantics of every other type of Request/Response pair.

Here's an example:

import com.twitter.finagle.stream.{Stream, StreamResponse}
import java.net.{URL, InetSocketAddress}
import com.twitter.util.Future
import com.twitter.conversions.time._
import com.twitter.finagle.{Service, ServiceFactory}
import com.twitter.finagle.builder.{ServerBuilder, Server, ClientBuilder}
import org.jboss.netty.handler.codec.http._

object Proxy {

  def main(args: Array[String]) {
    class Respond extends Service[HttpRequest, StreamResponse] {
      def apply(request: HttpRequest) = download(request.getUri)
    }

    val service = new Respond

    ServerBuilder()
      .codec(Stream().server)
      .bindTo(new InetSocketAddress(8080))
      .name("httpserver")
      .build(service)
  }

  val host = "www.fbi.gov"
  val port = 80

  val clientFactory: ServiceFactory[HttpRequest, StreamResponse] = ClientBuilder()
    .codec(Stream().client)
    .hosts(new InetSocketAddress(host, port))
    .hostConnectionLimit(1)
    .tcpConnectTimeout(5.seconds)
    .buildFactory()

  def client = clientFactory()

  def download(path: String):Future[StreamResponse] =  {
    println(path)
    val request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path)
    request.setHeader("Host", host)
    clientFactory() flatMap { _(request) }
  }
}

Run ab -n 10 -c 1 http://localhost:8080/spinner.gif to see it break.

Errors compiling finagle-benchmark

Hi, when I try to compile the whole project or just finagle-benchmark on it's own, I get the following errors in TaskTrackingtimer.scala because neither of com.twitter.finagle.util.{CountingTimer, TaskTrackingTimer} can be found.

[error] /Users/matt.brown/oss_projects/finagle/finagle-benchmark/src/main/scala/com/twitter/finagle/benchmark/TaskTrackingTimer.scala:5: CountingTimer is not a member of com.twitter.finagle.util
[error] import com.twitter.finagle.util.{CountingTimer, TaskTrackingTimer}
[error] ^
[error] /Users/matt.brown/oss_projects/finagle/finagle-benchmark/src/main/scala/com/twitter/finagle/benchmark/TaskTrackingTimer.scala:26: not found: type TaskTrackingTimer
[error] val timer = new TaskTrackingTimer(new FakeTimer)
[error] ^
[error] /Users/matt.brown/oss_projects/finagle/finagle-benchmark/src/main/scala/com/twitter/finagle/benchmark/TaskTrackingTimer.scala:47: not found: type CountingTimer
[error] val timer = new CountingTimer(new FakeTimer)
[error] ^
[error] three errors found
[error] {file:/Users/matt.brown/oss_projects/finagle/}finagle-benchmark/compile:compile: Compilation failed
[error] Total time: 6 s, completed Aug 9, 2012 3:54:47 PM

finagle ClientBuilder fails at runtime with scala 2.9.x

I get the following stack trace with scala 2.9.x

java.lang.NoSuchMethodError: scala.collection.Seq$.unapplySeq(Lscala/collection/Seq;)Lscala/Some;
at com.twitter.finagle.stats.RollupStatsReceiver.com$twitter$finagle$stats$RollupStatsReceiver$$tails(StatsReceiver.scala:107)
at com.twitter.finagle.stats.RollupStatsReceiver$$anon$5.(StatsReceiver.scala:123)
at com.twitter.finagle.stats.RollupStatsReceiver.stat(StatsReceiver.scala:122)
at com.twitter.finagle.stats.NameTranslatingStatsReceiver.stat(StatsReceiver.scala:139)
at com.twitter.finagle.channel.ChannelServiceFactory.(ChannelService.scala:148)
at com.twitter.finagle.builder.ClientBuilder$$anonfun$10.apply(ClientBuilder.scala:659)
at com.twitter.finagle.builder.ClientBuilder$$anonfun$10.apply(ClientBuilder.scala:638)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
at scala.collection.immutable.List.map(List.scala:45)
at com.twitter.finagle.builder.SocketAddressCluster.mkFactories(Cluster.scala:49)
at com.twitter.finagle.builder.ClientBuilder.buildFactory(ClientBuilder.scala:638)
at com.twitter.finagle.builder.ClientBuilder.build(ClientBuilder.scala:717)
....

This is the code to build the client:

  val client = ClientBuilder()
  .codec(Http())
  .hosts("localhost:8080")
  .hostConnectionLimit(1)
  .build()

It works fine on 2.8.1.

finagle-thrift and finagle-http suppress spans

The way the logic works here, in finagle-thrift, the client sends a header with the current trace_id, span_id, parent_id, etc. However, when the server receives the header, it sets those ids to be the current id, so that when it sends a span, the span has the same span id as the span from the parent. Since Zipkin expects those spans to be unique, it doesn't show them in the UI. The same bug is present in finagle-http, with http headers.

The workaround I found is for the client to send the "next" headers where the parent id is the current id and it generates a new span_id for the span_id field. However, I do not believe the finagle-thrift nor finagle-http drivers reflect this, so finagle-thrift talking to finagle-thrift will drop some headers, as will finagle-http talking to finagle-http, I believe.

If the finagle client changes the span header as some point in time, I missed where that was.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.