Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Alessandro Vermeulen
@spockz
I’m trying to create a warmup feature. The issue now is that when I add the module to the stack the whole stack isn’t instantiated until the very first request. Which is exactly what I want to trigger from my warmup module. How should I approach this? Should I actually already invoke and cache the service coming from the service factory in the module?
Alessandro Vermeulen
@spockz
@kevinoliver sorry to ping you for this but I know you have some experience with these Stack things. Do you know how I can do what I described above?
@avsudheer_twitter iirc, -1 on a stream means end of stream
Dermot Haughey
@hderms
If an HTTP client makes a request to a finagle server, and the request times out because of a client timeout (killing the TCP connection) will that cause Finagle to stop processing the request? I know that cancellable futures are a big deal in the Twitter ecosystem and what I'm seeing seems to suggest that's the case. In particular we have some Netty instrumentation via datadog that isn't seeing latency numbers greater than the timeout, they simply don't seem to appear at all. Additionally the datadog trace appears to never be sent to datadog. I am able to reproduce this behavior using cURL with a timeout sent, just wondering whether this is expected behavior or not and/or whether someone knows anything they can tell me.
paging Dr. @mosesn
Sergey Tselovalnikov
@SerCeMan
Hey, folks! I noticed that Finagle in the last release had reverted the netty update to twitter/finagle@cbfbef8 4.1.67 "due to a bug". Do you know what the bug is. Since netty is a transitive dependency, and it's used by plenty of oss libraries, it's likely that other dependency would bump it too, so I'm trying to understand the impact of having 4.1.67 on the same classpath as the latest finagle.
Alessandro Vermeulen
@spockz
@hderms I vaguely remember seeing RequestCancelled exceptions in the root monitor
Dermot Haughey
@hderms
@spockz so you're saying that it's likely what I'm describing is the case?
sachins301
@sachins301
Im getting this weird error while extending the TwitterServer trait, Exception in thread "main" java.lang.NoClassDefFoundError: com/twitter/util/Closable$class at microservices.Microservice$.<init>(Main.scala:37) at microservices.Microservice$.<clinit>(Main.scala) at microservices.Microservice.main(Main.scala) Caused by: java.lang.ClassNotFoundException: com.twitter.util.Closable$class at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 3 more
Any idea what could be causing this ?
joybestourous
@joybestourous
hey @SerCeMan , it was a known Netty issue introduced in 67 and fixed in 68: netty/netty#11591
1 reply
@sachins301 i believe c.t.util.Closable is an object, not a class: https://github.com/twitter/util/blob/develop/util-core/src/main/scala/com/twitter/util/Closable.scala
sachins301
@sachins301
How exactly is twitter finagle using the external dependencies for bazel builds? "3rdparty/jvm/com/fasterxml/jackson/module:jackson-module-scala", I dont see a workspace file, where is this 3rdparty located?
1 reply
Alessandro Vermeulen
@spockz
Arent they using pants? Or did they already complete the move to Bazel?
sachins301
@sachins301
I have no idea, why am i seeing sbt files as well in there.
Alessandro Vermeulen
@spockz
It was already sbt in the public repo even when Twitter was internally definitely still using pants
joybestourous
@joybestourous
we have not completely moved to bazel @sachins301 , it's possible we haven't yet migrated the targets you're looking at!
Alessandro Vermeulen
@spockz
Is there a way I can disable the jvm metrics? It is trying to access some method that is not accessible on the native-image.
2 replies
Lakshmanan Meiyappan
@laxmena

Hi everyone, Can someone share how to make requests to AWS API-Gateway endpoint from Finagle Client?

This is the codeblock I have now.

import com.twitter.finagle.{Http, Service}
import com.twitter.finagle.http
import com.twitter.util.{Await, Future}

object Client extends App {
  val client: Service[http.Request, http.Response] = Http.newService("something.execute-api.us-east-2.amazonaws.com:80")
  val request = http.Request(http.Method.Get, "/dev/service")
  request.host = "us-east-2.amazonaws.com"
  val response: Future[http.Response] = client(request)
  Await.result(response.onSuccess { rep: http.Response => println("GET success: " + rep) })
}

And this doesnt work.

2 replies
tibonarium
@tibonarium

Hi everyone. Finagle is a great project. But it has a small caveat.
I will try to describe an issue. Maybe you can suggest how to better fix it.

We are making requests to Keycloak for authentication using Request
https://github.com/twitter/finagle/blob/finagle-20.10.0/finagle-base-http/src/main/scala/com/twitter/finagle/http/Request.scala#L313

When we create Request to service that supports http/2 we need to provide the uri as origin-form = absolute-path [ "?" query ]

https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.1

But if we provide the full uri then after upgrading to http/2 it will fail with code 404 - Not Found

This request will return successful response

val redirect = "http://keycloak-app:8080/auth/realms/temp_realm/protocol/openid-connect/auth?state=123"
val redirectUri = new java.net.URI(redirect)
val originForm = s"${redirectUri.getPath}?${redirectUri.getQuery}"
val response: Future[Response] = client(Request(Method.Get, originForm))

But this request will fail with code 404 - Not Found

val redirect = "http://keycloak-app:8080/auth/realms/temp_realm/protocol/openid-connect/auth?state=123"
val response: Future[Response] = client(Request(Method.Get, redirect))

We need to always remember about this caveat and inform all new team members about it.

What steps do I need to take to change Request creation.
So that it always uses origin-form as uri even if we provide the full uri?
Do I need to create an issue at https://github.com/twitter/finagle?

1 reply
棟幹 尹鎭煜
@y00njinuk

Hello Guys, I have having some trouble in using Finagle.
finagle client I did developed as follow.

private val httpClient: Service[Request, Response] = Http.client
    .withMaxResponseSize(StorageUnit.fromMegabytes(httpMaxByte))
    .withRequestTimeout(Duration(httpMaxTimeout, TimeUnit.MILLISECONDS))
    .withTlsWithoutValidation
    .withSessionQualifier.noFailFast
    .newService(s"$hostname:$port")

but print error logs as follow....

"stack_trace": 
        com.twitter.finagle.ChannelClosedException: ChannelException at remote address: ***-***.*****.com/***.***.***.***:443 from service: ***-***.*****.com:443. 
        Remote Info: 
            Upstream Address: Not Available, 
            Upstream id: Not Available, 
            Downstream Address: ***-***.*****.com/***.***.***.***:443, 
            Downstream label: ***-***.*****.com:443, 
        Trace Id: bcdd14b050497fed.bcdd14b050497fed<:bcdd14b050497fed
            at com.twitter.finagle.netty4.transport.ChannelTransport$$anon$2.channelInactive(ChannelTransport.scala:176)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
            at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:81)
            at io.netty.handler.codec.MessageAggregator.channelInactive(MessageAggregator.java:438)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
            at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(Chann elInboundHandlerAdapter.java:81)
            at io.netty.handler.codec.http.HttpContentDecoder.channelInactive(HttpContentDecoder.java:225)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.ja va:262)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
            at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelInactive(CombinedChannelDuplexHandler.java:418)
            at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:38 6)
            at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:351)
            at io.netty.handler.codec.http.HttpClientCodec$Decoder.channelInactive(HttpClientCodec.java:288)
            at io.netty.channel.CombinedChannelDuplexHandler.channelInactive(CombinedChannelDuplexHandler.java:221)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
            at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:81)
            at com.twitter.finagle.netty4.channel.ChannelRequestStatsHandler.channelInactive(ChannelRequestStatsHandler.scala:41)
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive( AbstractChannelHandlerContext.java:262)
            at io.netty.channel.AbstractChannelHandlerCont

Now, why do you supoose that happened? and how i fix the problem?

Alessandro Vermeulen
@spockz
Do you see it every time? This could be due to mismatch in tls settings. Or because of a firewall or the remote closing the session
Denis Savitsky
@desavitsky
Hi!
Is there currently any support for streaming multipart requests in finagle?
I found that note: "Note: This is an experimental API, which will likely be changed in future to support streaming HTTP requests." in Multipart class
But didn't find anything else
1 reply
Alessandro Vermeulen
@spockz
@Denis-Savitsky I think it is supported by enabling streaming, and implement your own multipart parser on top of the buf reader.
For requests it is the same, but you would need provide your own reader to the request and stream in the multipart from your source
RAJKUMAR NATARAJAN
@rajcspsg
Hi Team
may I know the status of finagle for scala 3 ?
2 replies
Vénérée Randrianarisoa
@Maia1003_gitlab
I tried to create a server from :
https://github.com/twitter/finagle/blob/develop/finagle-example/src/main/scala/com/twitter/finagle/example/thrift/ThriftServer.scala
and I got this error: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". Could you give any help on how to resolve this problem ?
Alessandro Vermeulen
@spockz

When upgrading to 22.1 we noticed that we are execution more retries and that our response classifier is executed more often. We get back to the old numbers when disabling H2. On a quick glance it looks like when H2 is enabled the response classifier is seeing the original errors as with H1, but now also those same wrapped in a Failure.

Does anyone have any ideas?

1 reply
Vénérée Randrianarisoa
@Maia1003_gitlab
Hell, I have a server in Scala and a client in C++, I have those errors: could you explain how is happening here and how to solve those errors: WARNING: Unhandled exception in connection with /127.0.0.1:51796, shutting down connection
io.netty.handler.codec.TooLongFrameException: Adjusted frame length exceeds 2147483647: 2147549189 - discarded
at io.netty.handler.codec.LengthFieldBasedFrameDecoder.fail(LengthFieldBasedFrameDecoder.java:503)
at io.netty.handler.codec.LengthFieldBasedFrameDecoder.failIfNecessary(LengthFieldBasedFrameDecoder.java:489)
at io.netty.handler.codec.LengthFieldBasedFrameDecoder.exceededFrameLength(LengthFieldBasedFrameDecoder.java:376)
at io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:419)
at io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:332)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:446)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
1 reply
Manuel Doncel Martos
@manuelarte
Hi, I am using com.twitter.finagle.service to do http calls to a server, and I would like to log the request, with all the headers and body, how can I do that?
1 reply
Bo Sun
@hellsun24
hey guys, I am getting this error while sending a 5MB payload to fingle server: Request Entity Too Large with code 413. how should I fix this ?
1 reply
Moses Nakamura
@mosesn
hey folks, I’m starting the process for the 22.2.0 release today!
Alessandro Vermeulen
@spockz
Is anyone using Deadline on POST requests? I’m a bit worried that posts for which other calls need to be executed will not complete (completely) before the deadline runs out.
1 reply
Anton Guryanov
@Shekeen

Hi, I'm creating a finagle http client with a circuit breaker like this

Http.client
  .withResponseClassifier(HttpResponseClassifier.ServerErrorsAsFailures)
  .withSessionQualifier.noFailFast
  .withSessionQualifier.consecutiveFailuresFailureAccrual(5)
  .newService("localhost:8080")

And I use this client to send requests every second. The server on port 8080 is configured to always respond with 502, so I'm expecting this client to stop sending requests after 5 attempts. I see marking connection to "localhost:8080" as dead ... after 5 attempts in the logs, but the server keeps receiving requests. As far as I know, this is how Finagle's load balancer works by default: if all hosts are dead, it will still pick one randomly to send the request. But the behaviour I expect from a circuit breaker is to fail the request immediately if the breaker is open. Previously I could configure this behaviour by adding

  .configured(WhenNoNodesOpenParam(WhenNoNodesOpen.FailFast))

to the client. But this was removed in finagle 22.3.0: twitter/finagle@c9c21bf

Is there another way to configure a circuit breaker on a finagle http client that will stop the requests to a broken server?

1 reply
icoco
@icoco_gitlab
how to add new private protocol on Finagle
1 reply
icoco
@icoco_gitlab
Hi all, what cluster solution is best for Finagle service ?
2 replies
Ggg6542
@gusega
Hi here, how do I create a finagle client from java code? I do Http.newService("www.scala-lang.org:80"); but then the result is of type Service<Req, Rep> and there are no such types as Req and Rep. Thanks
7 replies
Ggg6542
@gusega
Hi here, what is the reason I get channel exception?
10 replies
Yawar Quadir Amin
@yamin-oanda
hi, i'm trying to fix an issue where an http client connects to my finagle thrift service, then closes the connection abruptly. meanwhile the thrift service connects to downstream mysql, and the abrupt connection close propagates to the mysql connection and closes it. when this happens repeatedly the mysql connection pool gets churned hard and the connections get poisoned. at least this is my working theory. i saw that this cancellation propagation behaviour can be prevented using MaskCancelFilter ( https://twitter.github.io/finagle/guide/FAQ.html?highlight=mysql#what-are-cancelledrequestexception-cancelledconnectionexception-and-clientdiscardedrequestexception ), but i'm not seeing a way to use that with a Mysql RichClient as it seems to require a Service. can anyone recommend a way to make them interop?
1 reply
just fyi, this is a sample of the stack trace: ```
com.twitter.finagle.CancelledRequestException: request cancelled. Remote Info: Upstream Address: Not Available, Upstream id: Not Available, Downstream Address: db-sfb-rates.svc.oanda.com/172.27.44.25:3306, Downstream label: sfb_rates:read/mysql, Trace Id: 3db624dca0957e03.285dfe4f0f9aac3d<:3db624dca0957e03 2022-04-26 13:03:02,031 WARN c.t.f.u.DefaultMonitor: Exception propagated to the default monitor (upstream address: /10.42.3.78:48400, downstream address: db-sfb-rates.svc.oanda.com/172.27.44.25:3306, label: sfb_rates:read/mysql). com.twitter.finagle.mysql.PoisonConnection$PoisonedConnectionException: null 2022-04-26 13:03:02,031 WARN c.t.f.m.RollbackFactory: rollback failed when putting service back into pool, closing connection com.twitter.finagle.ChannelWriteException: com.twitter.finagle.ChannelClosedException: null at remote address: db-sfb-rates.svc.oanda.com/172.27.44.25:3306. Remote Info: Not Available from service: sfb_rates:read/mysql. Remote Info: Upstream Address: Not Available, Upstream id: Not Available, Downstream Address: db-sfb-rates.svc.oanda.com/172.27.44.25:3306, Downstream label: sfb_rates:read/mysql, Trace Id: 5f7d4bbea9e81ec4.4849a55aadd1cd91<:5f7d4bbea9e81ec4
Yawar Quadir Amin
@yamin-oanda
ok, figured it out. had to hand-roll the service factory to allow composing it with the MaskCancelFilter:
val mySqlClient = Mysql.client
val mask = new MaskCancelFilter[Request, Result]
val client = mySqlClient
  .withCredentials(...)
  .withDatabase(...)
  .configured(...)
val svcFactory = mask.andThen(client.newClient("host:port"))

mysql.Client(
  factory = svcFactory,
  statsReceiver = client.richClientStatsReceiver,
  supportUnsigned = client.params[UnsignedColumns].supported)
Lars
@lars-n
Hi there, I'm looking for a way to build form data http requests using finagle for http PUT (unfortunately a requirement ). There is a nice and easy way for POST, but so far I didn't see a way for any other http methods.
Alessandro Vermeulen
@spockz
@lars-n what I do is just use the methods to create the request and then I change the method to PUT on the created request before sending it to the client
Lars
@lars-n

yes, that changes the method, but unfortunately it also causes the form elements to not be encoded correctly. What would probably help is having the Netty4FormPostEncoder visible outside the package

Maybe there is a better way in a later version? We're currently on 20.12.0

Lars
@lars-n
ok, my bad. Think I figured it out. Thanks Alessandro
Yawar Quadir Amin
@yamin-oanda

hello, i'm back with another issue. i'm upgrading from Finagle 19.6.0 to 22.4.0, and a trick we were using to multiplex two separate Thrift IDLs (let's call them S1 and S2) on a single port, no longer seems to be working. our code looks like:

class CombinedService$FinagleService(
  iface: S1.MethodPerEndpoint with S2.MethodPerEndpoint,
  serverParam: RichServerParam)
  extends S1$FinagleService(iface, serverParam) {

  // We extend and load the generated S2 service so that we can expose the map of functions it provides
  private val s2 = new S2$FinagleService(iface, serverParam) {
    val functions = serviceMap
  }

  // and then add those functions to S1 so it can accept requests for S2
  for ((name, func) <- s2.functions) addService(name, func)
}

before the upgrade, this was working and both S1 and S2 methods were being served. after the upgrade (and switch from HKT-style to MethodPerEndpoint style), the S2 methods are no longer found: org.apache.thrift.TApplicationException: Invalid method name: 'getXYZ'
any ideas how to fix this?

Yawar Quadir Amin
@yamin-oanda
ok i think i figured it out. just need to create a Service manually instead of using the serveIface method to find my Thrift service:
    val thriftServer = Thrift
      .server
      // enable thrift method request counts
      .withPerEndpointStats
      .serve(serverPort(), new CombinedService$FinagleService(combinedService, RichServerParam()))
//      .serveIface(serverPort(), combinedService)
Alessandro Vermeulen
@spockz
Is anyone using dynamic time-outs with clients constructed using the method builder? The dynamic timeout isn’t picked up. Even if I replace the timeout module in the stack before instantiating the method builder
1 reply