Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 14 20:36

    finaglehelper on develop

    inject-core: Remove target alia… (compare)

  • Nov 14 18:23

    finaglehelper on develop

    finatra-kafka: Update integrati… (compare)

  • Nov 13 20:18

    finaglehelper on develop

    twitter-server: introduce abili… (compare)

  • Nov 12 23:23

    finaglehelper on develop

    finatra-http: Move mustache fun… (compare)

  • Nov 12 05:50
    cacoco labeled #511
  • Nov 11 23:38

    finaglehelper on develop

    [logging] move dependency on sl… (compare)

  • Nov 08 01:33

    finaglehelper on develop

    Finatra: Update dependency inje… (compare)

  • Nov 08 00:23

    finaglehelper on develop

    twitter-server: move IsolateFil… (compare)

  • Nov 07 21:30

    finaglehelper on develop

    finatra: update streaming docs … (compare)

  • Nov 07 19:37

    finaglehelper on develop

    finatra: remove duplicate depen… finatra-http: Don't treat Strin… (compare)

  • Nov 06 18:18

    finaglehelper on develop

    twitter-oss: Update OSS Librari… (compare)

  • Nov 06 18:06

    finaglehelper on gh-pages

    site push by csl (compare)

  • Nov 06 02:46
    kimxogus opened #511
  • Nov 06 00:41

    finaglehelper on finatra-19.11.0

    (compare)

  • Nov 04 23:22

    finaglehelper on develop

    finatra-http: make CallbackConv… (compare)

  • Nov 01 01:22

    finaglehelper on develop

    finatra-thrift: Pants provided … (compare)

  • Oct 30 19:19

    finaglehelper on develop

    util-core: Introduce Reader.rea… (compare)

  • Oct 30 17:18

    finaglehelper on develop

    finatra-thrift: Move src/test t… (compare)

  • Oct 29 19:17

    finaglehelper on develop

    finatra-http: Deprecate `c.t.fi… (compare)

  • Oct 29 18:18

    finaglehelper on develop

    finatra: Make the StreamingServ… (compare)

Christopher Coco
@cacoco
(a listening server is the process that listens on a specific port and reads bytes from the wire sending to a Finagle Service[R,R] to be handled)
you can always create new listening servers, serving any Service[R,R] you want.
Georgy Satosov
@GSatosov

May I see a snippet? When I try to do something like:

 private val publicServer = new HttpServer {
  override val defaultHttpPort: String = ":8082"

// some controller setup.
}
private val metricServer = new HttpServer {
  override val defaultHttpPort = ":9345"
 // more controller setup
}

It just handles the requests from the server that I specify in main method first.

Christopher Coco
@cacoco
you wouldn’t use the HttpServer trait here as it assumes a specific port
think of it this way, you have a container, that is TwitterServer
if you mix in the HttpServer trait you just made that container a single HttpServer
thus if you want to serve multiple you want composition not inheritance
so you’d stick with a TwitterServer and create listening servers inside
Georgy Satosov
@GSatosov
Thank you, I'll try that promptly.
Christopher Coco
@cacoco
Finatra doesn’t provide utils out of the box for this scenario but doesn’t prevent you from doing it either. We’re kicking around internally right now actually about making it easier to expose multiple listening servers of the same protocol within a TwitterServer
But if you start with an injectable version of TwitterServer (the container) you’ll be most of the way there. You just need to follow what we do in creating and starting an Http ListeningServer here. That is you want to do something like Http.server.serve(“:port”)in an override of the postWarmup lifecycle method.
sinanspd
@sinanspd
out of curiosity, are there any plans to create a GraphQL extension for finatra, now that Twitter jumped on the GraphQL train. (Or does anyone know a library that integrates smoothly with finatra, sangria seems to be a popular option?)
Christopher Coco
@cacoco
@sinanspd Twitter has been using GraphQL for years now — so not really new. There are no plans currently to try to offer any GraphQL primitives in Finatra, I’m not sure what we’d do. And yes, we use Sangria as well.
sinanspd
@sinanspd
I meant the graphQl foundation train sorry, not starting to use it :) Understood. I am slowly starting the boilerplate framework and I think it will be smarter to go down the QL path so was just wondering.
Christopher Coco
@cacoco
Yeah, we plan on being contributors to Sangria, not sure how that will necessarily affect Finatra the framework. Right now nothing is planned as it is somewhat orthogonal to the Finatra framework.
sinanspd
@sinanspd
understood, thank you for the info
Georgy Satosov
@GSatosov
One more question: currently my app exposes a method to get swagger schema using the finatra-swagger library plugged in HttpServer as a module. Can it be done using TwitterServer as well?
Christopher Coco
@cacoco
Yep, modules are supported at App and down
sinanspd
@sinanspd
I have started receiving this error on my startup tests
Unfortunately this did not cause the test to fail so I missed it and can't find exactly what commit broke it. Any ideas on how to go about debugging ?

com.twitter.app.CloseException: An error occurred on exit
    Suppressed: com.twitter.util.TimeoutException: 2019-09-14 00:24:04 +0000
        at com.twitter.util.Future.$anonfun$by$1(Future.scala:1662)
        at com.twitter.util.Future$$anon$4.apply$mcV$sp(Future.scala:1683)
        at com.twitter.util.Monitor.apply(Monitor.scala:46)
        at com.twitter.util.Monitor.apply$(Monitor.scala:41)
        at com.twitter.util.NullMonitor$.apply(Monitor.scala:229)
        at com.twitter.util.Timer.$anonfun$schedule$2(Timer.scala:39)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at com.twitter.util.Local$.let(Local.scala:4904)
        at com.twitter.util.Timer.$anonfun$schedule$1(Timer.scala:39)
        at com.twitter.util.Monitor.apply(Monitor.scala:46)
        at com.twitter.util.Monitor.apply$(Monitor.scala:41)
        at com.twitter.util.NullMonitor$.apply(Monitor.scala:229)
        at com.twitter.util.Timer.$anonfun$schedule$2(Timer.scala:39)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at com.twitter.util.Local$.let(Local.scala:4904)
        at com.twitter.util.Timer.$anonfun$schedule$1(Timer.scala:39)
        at com.twitter.finagle.netty4.util.Netty4Timer$$anon$1$$anon$2.run(Netty4Timer.scala:15)
        at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:682)
        at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:757)
        at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:485)
        at java.lang.Thread.run(Thread.java:748)
sinanspd
@sinanspd

narrowed it down to DatabaseModule. Seems to be coming from here:

 override def singletonShutdown(injector: Injector) = {
    super.singletonShutdown(injector)
    injector.instance[MongoDataBaseConnector].close()
  }

where close is

  val mongoClient: MongoClient = MongoClient(url)
  val database: MongoDatabase =  mongoClient.getDatabase(dbscope)

  def close(): Unit = {
    mongoClient.close()
  }
is there a better way to do shutdowns?
Christopher Coco
@cacoco
@sinanspd it's not something that broken, we're just finally surfacing errors on closing that were orphaned before in testing. It means your not waiting long enough for all your resources to close.
Since you're closing anyway it typically doesn't affect anything but it can if you're not shutting down the jvm and are leaving resources open or in a bad state.
sinanspd
@sinanspd

Gotcha I figured this likely came after I upped the version
what is a good place to specify timeout? Unfortunately mongo.close() returns unit so there isn't a good way to resolve it as a future.

is there any other shutdowns required apart from what is above and this (for finatra at least)

  override protected def afterAll() = {
    server.close()
  }
sinanspd
@sinanspd

this seems to fix the issue

 server.close(Duration.fromSeconds(50))

But holy **, does mongo suck. It finally stopped erroring at 50 seconds. A DB close really shouldn't take anywhere close to that. They also report negative connections.. Note to self to stick with Postgres next time

Christopher Coco
@cacoco
@sinanspd it should be enough to set a different grace period in your app. Override what is provided by App.
sinanspd
@sinanspd
thanks!
Christopher Coco
@cacoco
Generally you want to register the close of the DB with an onExit block so that the server wraps closing in a Closable and uses the grace period to await closing.
See the shutdown lifecycle section
Kasper Kondzielski
@ghostbuster91
Hi, can somebody explain me what are the preconditions for message to be chunked? Especially I would like it always to be chunked so I can stream it.
Srepfler Srdan
@schrepfler
Hi, I'm parsing a FormData (multipart/html-form) request with RequestUtils.multiParams helper function but I'm getting a rather nasty exception
org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found~
any idea what might be the problem here?
Srepfler Srdan
@schrepfler
found it, I was setting content type explicitly in the JS that was sending the form so the browser was not injecting the boundary parameter automatically
tedfp
@tedfp

I have a problem that I thought it might be more related to my client command but before that, I would like to double check if anything I miss while using finatra streaming api. The server side code looks like

  post("/api/streaming_test") { streamingRequest: StreamingRequest[Reader, Item] =>
    val closable = Closable.nop
    val responseReader: Reader[String] = streamingRequest.stream.map { item => 
      println(s"item: $item")
      item.name + item.value
    }
    responseReader.onClose.ensure(closable.close())
    response.streaming(responseReader)
  }

But when executing curl client command

curl "http://localhost:8888/streaming_test" \
     --http1.0 \
     -H "Connection:Keep-Alive" \
     -H "Content-Type:application/json" \
     --data-binary "@/path/to/data.json"

It returns transfer closed with outstanding read data remaining. But a more important thing I notice is the server side code println(s"item: $item") doesn't get printed on console. Any reason that may cause the ...stream.map() function not getting executed? I appreciate any suggestions.

data.json is a json file looks like
{ "name": "B", "value": 9.95 }
{ "name": "A", "value": 13.2}
Yufan Gong
@yufangong
@tedfp The streaming endpoint looks good to me, i don't spot anything obvious that can stop it. Is there a feature test for "api/streaming_test” we can look at? From your curl, it’s HTTP 1.0? I’m not sure if HTTP 1.0 has support for streaming messages, can you use HTTP 1.1 and give it another try?
Christopher Coco
@cacoco
@tedfp yeah I’m pretty sure it requires chunked encoding which is only in HTTP 1.1.
Sladyn
@sladyn98
Hello guys, I was browsing through community bridge and came across this super interesting project https://people.communitybridge.org/project/aa32cad5-7103-4a6a-95f3-9adb76664801
Are you guys still interested in mentoring students ? Thanks
Richard Chuo
@forthy

@cacoco Christopher, I am working on upgrading Tapir's (https://github.com/softwaremill/tapir) Finatra support. I found the current server backend support is only up to Finatra 19.4.0. I found there is a change in RouteDSL which replaced Manifest with TypeTag). It is not an issue when upgrading Tapir’s Finatra version. However, the issue now I run into is that without any code change, the following registered routes:

[info] ANY     /seed/:param
[info] ANY     /seed/:param/

work (routes can be found and the target Request ⇒ Future[Response] functions) in Finatra version up to 19.8.0. However, after 19.8.0, say 19.11.0, those two routes will report 404. Can you think of any possible pointer for me to dig further into this issue? Thank you very much indeed.

Richard Chuo
@forthy
@cacoco Christopher, I realised that the handling of AnyMethod was changed after Finatra 19.8.0 after digging into the codebase. That should be the cause of my issue. Thanks, anyway! :D
Christopher Coco
@cacoco
@forthy ok glad you figured it out
Sladyn
@sladyn98

@cacoco

Hello guys, I was browsing through community bridge and came across this super interesting project https://people.communitybridge.org/project/aa32cad5-7103-4a6a-95f3-9adb76664801
Are you guys still interested in mentoring students ? Thanks

Could you kindly help me out with this ?

Christopher Coco
@cacoco
Hey @sladyn98 sorry, I meant to respond to this earlier. I don’t know the status of of community bridge initiative. Let me ask our open source program office.
Sladyn
@sladyn98
@cacoco that's all right, do let me know cheers
Richard Chuo
@forthy
@cacoco Christopher, what is your suggestion to avoid the function conflict (function trace of RouteDSL and Logging’s) in a Controller? Thanks!
Christopher Coco
@cacoco
@forthy the logging function is a wrapper Proxying to a logger member. Call trace directly on the logger. If that doesn't work, please file an issue. Thanks!
Richard Chuo
@forthy
Thanks!
Tomasz Gorski
@tgod
hi! What metrics do you use to decide when to scale up/scale down your Finatra services?