Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Ben Spencer
@dangerousben
thanks
Ayush
@ayushworks
Hi , is there any example of creating a request from a file ? i tried something like this
val file : File = ???
val headers: Map[String, String] = ???
val byteArray: Array[Byte] = Files.readBytes(file)
val bArray = new Buf.ByteArray(byteArray, 0, f.size.toInt)
val formElement = FileElement(name = f.name, content = bArray, contentType = headers.get("Content-Type"), filename = Some(f.name))
val request = requestBuilder.add(formElement).buildFormPost(false)
the problem is the request gets created with a two content-type headers ..one that is in my original list of headers
and somehow the buildFormPost adds another content-type header ..upon debugging i see HttpPostRequestEncoder adding the application/x-www-form-urlencoded value to content-type header
so my final request has two headers for content-type and the server(akka-http) rejects this request saying HTTP message must not contain more than one Content-Type header
Moses Nakamura
@mosesn
hmm, sounds like a bug, we should pick one of them. can you file a ticket with us on github? in the mean time, can you try not specifying the content type?
Alessandro Vermeulen
@spockz
Or nuke one of the headers afterwards if you really need your own content type.
Ayush
@ayushworks
@spockz @mosesn thanks !
Frederick Cai
@zhenwenc
Hi all, I created a client ServiceFactory with ClientBuilder, but how can I properly shutdown the client (after test)? I tried ServiceFactory#close method, but the Netty 4 Timer is still running after that, by viewing the thread dump:
"Netty 4 Timer-1" #377 daemon prio=5 os_prio=31 cpu=1159.34ms elapsed=232.23s tid=0x00007fd71a19a800 nid=0xe513 sleeping [0x000070001f814000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep(java.base@12.0.2/Native Method)
        at io.netty.util.HashedWheelTimer$Worker.waitForNextTick(HashedWheelTimer.java:579)
        at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:478)
        at java.lang.Thread.run(java.base@12.0.2/Thread.java:835)

   Locked ownable synchronizers:
        - None
Christopher Coco
@cacoco
A ServiceFactory merely is a way to get a Service. You close a Service.
Moses Nakamura
@mosesn
the Netty 4 Timer is a daemon thread, why do you need to tear it down manually? it shouldn’t block your jvm from dying.
Frederick Cai
@zhenwenc
Its in test
Moses Nakamura
@mosesn
please elaborate–it’s a singleton, so there should be exactly one thread
if your testing framework won’t shutdown when you have daemon threads running, there might be a problem with your testing setup.
fwiw, the resource that you close by closing a ServiceFactory is connections (implicitly, file descriptors). it’s not threads, because Finagle is a non-blocking framework that doesn’t tie each connection to a unique thread. so if you’re concerned about cleaning up your connections, just closing the servicefactory should be enough. as chris said, please ensure that you have also closed the services that are returned from the servicefactory, so that it knows that it’s safe to cut the connection.
Frederick Cai
@zhenwenc
The ServiceFactory client was pointing to a remote resource (say Github API). I am using scalatest and sbt.
Moses Nakamura
@mosesn
is your sbt failing to shut down?
which version of sbt and scalatest?
Frederick Cai
@zhenwenc

Sorry I am pretty new to finagle, what do you mean by 'closing the services that are returned from the servicefactory' in this case? And what confusing me is, even though I don't use the servicefactory to send any request, simply create with ClientBuilder then call Await.result(factory.close()), the issue still occurs.

I am using sbt.version=1.3.3 and scalatest 3.0.8

sbt will print this warning message after test completed:
[warn] Thread[Netty 4 Timer-1,5,Netty 4 Timer] loading com.twitter.util.Monitor$ after test or run has completed. This is a likely resource leak
Moses Nakamura
@mosesn
@zhenwenc try using a forked jvm https://www.scala-sbt.org/1.x/docs/Forking.html
Frederick Cai
@zhenwenc
Yeah, will try with fork in Test. Many thanks for your help! Much appreciated!
Moses Nakamura
@mosesn
👍
Moses Nakamura
@mosesn
@HenryCaiHaiying @adleong we managed to restore jars to maven.twttr.com, sorry for the delay. I’ll try to get com.hadoop.gplcompression hadoop-lzo uploaded to maven central. in the mean time, I suggest that you try to migrate off of the twitter commons libs that you’re still relying on if it’s possible, to libraries that are hosted by maven central. we’ll try to keep maven.twttr.com up as an archive, but as you’ve recognized, we don’t have great monitoring for it.
Alex Leong
@adleong
thank you, @mosesn! I can confirm our build has gone green again! :tada:
Alessandro Vermeulen
@spockz
@martijnhoekstra #797 has been merged. What do we do with martijnhoekstra/finagle#1 ?
Henry Haiying Cai
@HenryCaiHaiying
Thanks @mosesn we've already migrated to the jars hosted by maven central
Martijn Hoekstra
@martijnhoekstra
@spockz re-submit as a PR against twitter/finagle
last I checked, it rebases cleanly
do you have time to do the re-submission?
Alessandro Vermeulen
@spockz
@martijnhoekstra probably tonight yes
Martijn Hoekstra
@martijnhoekstra
:+1:
Moses Nakamura
@mosesn
glad to hear it @HenryCaiHaiying, that’ll be better for you in the long term anyway :thumbsup:
Dave Rusek
@davidjrusek_twitter
HI, I'm going to start the Twitter OSS release today (twitter-server, finagle, finatra, and util)
and scrooge
Alessandro Vermeulen
@spockz
@martijnhoekstra didn’t get to it yesterday night and now to late for the December release ☹️
Moses Nakamura
@mosesn
that’s ok! the january release will be here in like three weeks :)
we’re a bit late with december but hopefully we won’t be with january
Alessandro Vermeulen
@spockz
Let’s call it a delayed Christmas gift then 😁
Yes that is fine!
We need to do other modules as wel before we can go fully over. Something for Christmas break
Dave Rusek
@davidjrusek_twitter
Due to some internal processes I needed to wait to complete, I will push the release off until tomorrow.
Martijn Hoekstra
@martijnhoekstra
Alessandro Vermeulen
@spockz
@martijnhoekstra hero
Martijn Hoekstra
@martijnhoekstra
I just git cherry-pick'ed, I didn't do any actual work on that
Alessandro Vermeulen
@spockz
I know. I have just been away from a machine for too long
Martijn Hoekstra
@martijnhoekstra
too long? Or an unusually healthy amount of time?
Alessandro Vermeulen
@spockz
Too long as in too many meetings instead of doing stuff