Giter Club home page Giter Club logo

pekko-http's Introduction

Apache Pekko HTTP

The Pekko HTTP modules implement a full server- and client-side HTTP stack on top of pekko-actor and pekko-stream. It's not a web-framework but rather a more general toolkit for providing and consuming HTTP-based services. While interaction with a browser is of course also in scope it is not the primary focus of Pekko HTTP.

Pekko HTTP is a fork of Akka HTTP 10.2.x release, prior to the Akka project's adoption of the Business Source License.

Pekko HTTP follows a rather open design and many times offers several different API levels for "doing the same thing". You get to pick the API level of abstraction that is most suitable for your application. This means that, if you have trouble achieving something using a high-level API, there's a good chance that you can get it done with a low-level API, which offers more flexibility but might require you to write more application code.

Documentation

The documentation is available at pekko.apache.org, for Scala and Java.

Building from Source

Prerequisites

  • Make sure you have installed a Java Development Kit (JDK) version 8 or later.
  • Make sure you have sbt installed.
  • Graphviz is needed for the scaladoc generation build task, which is part of the release.

h2spec

Some tests for HTTP/2 compliance use h2spec. The sbt build downloads pre-built binaries from the GitHub releases page for the h2spec project. These binaries are not available for all operating systems. Apple Mac Silicon users may need to install Rosetta if they do not have it installed already.

Running the Build

  • Open a command window and change directory to your preferred base directory
  • Use git to clone the repo or download a source release from https://pekko.apache.org (and unzip or untar it, as appropriate)
  • Change directory to the directory where you installed the source (you should have a file called build.sbt in this directory)
  • sbt compile compiles the main source for project default version of Scala (2.13)
    • sbt +compile will compile for all supported versions of Scala
  • sbt test will compile the code and run the unit tests
  • sbt testQuick similar to test but when repeated in shell mode will only run failing tests
  • sbt package will build the jars
    • the jars will built into target dirs of the various modules
    • for the the 'http-core' module, the jar will be built to http-core/target/scala-2.13/
  • sbt publishLocal will push the jars to your local Apache Ivy repository
  • sbt publishM2 will push the jars to your local Apache Maven repository
  • sbt docs/paradox will build the docs (the ones describing the module features)
    • sbt docs/paradoxBrowse does the same but will open the docs in your browser when complete
    • the index.html file will appear in target/paradox/site/main/
  • sbt unidoc will build the Javadocs for all the modules and load them to one place (may require Graphviz, see Prerequisites above)
    • the index.html file will appear in target/scala-2.13/unidoc/
  • sbt sourceDistGenerate will generate source release to target/dist/
  • The version number that appears in filenames and docs is derived, by default. The derived version contains the most git commit id or the date/time (if the directory is not under git control).
    • You can set the version number explicitly when running sbt commands
      • eg sbt "set ThisBuild / version := \"1.0.0\"; sourceDistGenerate"
    • Or you can add a file called version.sbt to the same directory that has the build.sbt containing something like
      • ThisBuild / version := "1.0.0"

Community

If you have questions about the contribution process or discuss specific issues, please interact with the community using the following resources.

  • GitHub discussions: for questions and general discussion.
  • Pekko users mailing list: for Pekko development discussions.
  • Pekko dev mailing list: for Pekko development discussions.
  • GitHub issues: for bug reports and feature requests. Please search the existing issues before creating new ones. If you are unsure whether you have found a bug, consider asking in GitHub discussions or the mailing list first.

Contributing

Contributions are very welcome!

If you see an issue that you'd like to see fixed, the best way to make it happen is to help out by submitting a pull request. For ideas of where to contribute, tickets marked as "help wanted" are a good starting point.

Refer to the CONTRIBUTING.md file for more details about the workflow, and general hints on how to prepare your pull request. You can also ask for clarifications or guidance in GitHub issues directly.

License

Apache Pekko HTTP is Open Source and available under the Apache 2 License.

pekko-http's People

Contributors

2m avatar aruediger avatar bantonsson avatar chbatey avatar ennru avatar gosubpl avatar hawstein avatar he-pin avatar ignasi35 avatar jiminhsieh avatar jlprat avatar johanandren avatar jonas avatar jrudolph avatar jypma avatar ktoso avatar leachbj avatar mdedetrich avatar naferx avatar patriknw avatar philippus avatar pjfanning avatar raboof avatar rbudzko avatar richardimaoka avatar rkuhn avatar scala-steward avatar scala-steward-asf[bot] avatar sirthias avatar viktorklang 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

pekko-http's Issues

acknowledge `Mathias Doenitz, Alexander Myltsev` copyright in our main LICENSE

http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/StringBuilding.scala

has this source header

/*
 * Copyright (C) 2009-2017 Mathias Doenitz, Alexander Myltsev
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Licensing headers issues in 1.0.0-RC1

  • LICENSE is possibly missing 3rd party code licenses due to the number of files with missing headers? Also these 3rd party files files
    • ./http-core/src/main/scala/org/apache/pekko/http/impl/engine/ws/Utf8Decoder.scala - nothing to do
    • ./http-core/src/main/scala/org/apache/pekko/http/impl/model/parser/StringBuilding.scala #249
    • ./http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/util/AsciiTreeLayout.scala #248
    • SSE #250
      • ./http-tests/src/test/java/org/apache/pekko/http/javadsl/marshalling/sse/EventStreamMarshallingTest.java
      • ./http-tests/src/test/java/org/apache/pekko/http/javadsl/unmarshalling/sse/EventStreamUnmarshallingTest.java
      • ./http-core/src/test/java/org/apache/pekko/http/javadsl/model/sse/ServerSentEventTest.java
      • ./http-core/src/main/java/org/apache/pekko/http/javadsl/model/sse/ServerSentEvent.java
      • ./http-core/src/main/java/org/apache/pekko/http/javadsl/model/headers/LastEventId.java
    • ./http-core/src/main/scala-2.13-/org/apache/pekko/http/ccompat/CompatImpl.scala - nothing to do
  • These files are missing headers and are of an unknown license
    • ./docs/src/main/paradox/assets/js/scrollToFragment.js #242
    • ./http-scalafix/scalafix-tests/src/test/scala/org/apache/pekko/http/fix/RuleSuite.scala #243
  • These scripts without license headers can be removed #241
    • ./scripts/authors.pl
    • ./scripts/authors.scala
    • ./scripts/commits-for-release-notes.sh
    • ./scripts/convert_tabs_to_spaces.sh
    • ./scripts/dos_to_unix.sh
    • ./scripts/find-javadoc-error.pl
    • ./scripts/release_stats.sh
    • ./scripts/remove_trailing_whitespace.sh
    • ./scripts/build/github-tagging.sh
  • These files seem to have incorrect headers #240
    • ./http/src/main/boilerplate/org/apache/pekko/http/javadsl/server/JavaPathMatchers.scala.template
    • ./http/src/main/boilerplate/org/apache/pekko/http/scaladsl/server/directives/FormFieldDirectivesInstances.scala.template
    • ./http/src/main/boilerplate/org/apache/pekko/http/scaladsl/server/directives/ParameterDirectivesInstances.scala.template
    • ./http/src/main/boilerplate/org/apache/pekko/http/scaladsl/server/util/ApplyConverterInstances.scala.template
    • ./http/src/main/boilerplate/org/apache/pekko/http/scaladsl/server/util/ConstructFromTupleInstances.scala.template
    • ./http/src/main/boilerplate/org/apache/pekko/http/scaladsl/server/util/TupleAppendOneInstances.scala.template
    • ./http/src/main/boilerplate/org/apache/pekko/http/scaladsl/server/util/TupleFoldInstances.scala.template
  • Remove autobahn scripts (not relevant any more, used for some extra validation on old Jenkins) #238
    • ./http-core/src/test/scripts/autobahn-jenkins/
  • This file (mentioned in license) also has an incorrect header #246
    • /http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/DateTime.scala
  • Add a note explaning what this file is #239
    • ./http-tests/src/test/extra-libs.zip

Track upstreamed performance changes for parboiled2

Due to #14 we are now using an upstream parboiled2 rather than having our own in source version. As a result of this change we lost some minor performance improvements that was done internally which haven't been upstreamed to parboiled2 yet (see #1 (comment))

This is a meta issue to track these upstream changes

Regenerate images in documentation which have akka references

Can't remember precisely where but there are images in the current pekko Paradox docs which refer to Akka. Some examples I can remember are a visalized flamegraph and also a screenshot of a http webserver that still has Akka in it.

We should regenerate the screenshots so that they have Pekko naming instead and update the docs to reflect this.

docs: issue with scala/java links

In some .md files, we have links like:

introduction.md

See @scala[@ref[JSON Support](common/json-support.md))]@java[@ref[JSON Support](common/json-support.md#jackson-support))] for more information about integration

This is being rendered as 2 links with the same name beside each other, when I think the intent is that one shows depending on whether you've chosen Java or Scala.

See https://nightlies.apache.org/pekko/docs/pekko-http/main-snapshot/docs//introduction.html

image

This is just one example. I checked a few more and they have similar issues.

ensure scala-3 branch ends up with all the changes on main branch

  • scala-3 branch is basically a fork of main branch but with support for Scala3.
  • it has been updated with most of the recent commits to main (cherry-picked or an equivalent commit if the cherry pick did not work)
  • one major commit that needs to be duplicated in scala-3 branch is 56158e4 -- this one did not cherry pick well, huge conflicts
    • I don't know of any other missing Pekko era commits that are not brought across
  • there might be other commits that were missed from Akka times (ie from before Pekko work started)

FAILED: org.apache.pekko.http.scaladsl.unmarshalling.MultipartUnmarshallersSpecCRLF ► The MultipartUnmarshallers. should multipartGeneralUnmarshaller should correctly unmarshal 'multipart/*' content with should a boundary with spaces

https://github.com/apache/incubator-pekko-http/actions/runs/4242607074/jobs/7374328757#step:7:2404

- should a boundary with spaces *** FAILED *** (1 second, 83 milliseconds)
[info]     java.util.concurrent.TimeoutException: Futures timed out after [1 second]
[info]     at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:259)
[info]     at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:263)
[info]     at scala.concurrent.Await$.$anonfun$result$1(package.scala:223)
[info]     at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:57)
[info]     at scala.concurrent.Await$.result(package.scala:146)
[info]     at org.apache.pekko.http.scaladsl.unmarshalling.MultipartUnmarshallersSpec.$anonfun$haveParts$1(MultipartUnmarshallersSpec.scala:440)
[info]     at org.scalatest.matchers.Matcher$$anon$1.apply(Matcher.scala:491)
[info]     at org.scalatest.matchers.should.Matchers$ShouldMethodHelperClass.shouldMatcher(Matchers.scala:6770)
[info]     at org.scalatest.matchers.should.Matchers$AnyShouldWrapper.should(Matchers.scala:6822)
[info]     at org.apache.pekko.http.scaladsl.unmarshalling.MultipartUnmarshallersSpec.$anonfun$$init$$18(MultipartUnmarshallersSpec.scala:220)

code: update any refs to Akka HTTP version numbers

  • deprecated code ('since' property)
  • comments

may refer to Akka HTTP 10.2.0 (as an example) - we probably need to change the code to say since = "Akka HTTP 10.2.0" to highlight that the version is not a Pekko HTTP version number.

review repo code to find if we bundle code that is not from Akka or Pekko originally

  • such code will probably need to be mentioned in our LICENSE and/or NOTICE files
  • in incubator-pekko, we have examples where we have protobuf-java code used in pekko jars (as an example)
  • there certainly seems to be code from the shapeless lib and this may need changes to our docs (pekko-parsing lib) -- Apache licensed: https://github.com/milessabin/shapeless
  • also parboiled code (pekko-parsing lib) -- Apache licensed: https://github.com/sirthias/parboiled2

fix links to pekko javadoc/scaladoc

pekko-http build uses .link to get the version number to use scaladoc/javadoc links
https://github.com/apache/incubator-pekko-http/blob/main/build.sbt#L429

.link provides the x.y version as opposed to x.y.z version

At the moment, for Pekko, we only publish 1.0.0 but these links point to 1.0.

Example: see the Flow[HttpRequest, HttpResponse, _] link in https://pekko.apache.org/docs/pekko-http/current/introduction.html#low-level-http-server-apis

  • we could change the pekko-http build to use the x.y.z version in these links
  • we could update .htaccess to redirect 1.0 to 1.0.0 (but this has a big maintenance overhead, we'd have to change the .htaccess after every release.

try to avoid shutdown hooks

See #170

It is usually better to try to manage the lifecycle of the temp files in code so that they are deleted explicitly in code when they are no longer needed.

It looks like when the PR code above is used, that the code does remove the file explicitly - see https://github.com/apache/incubator-pekko-http/blob/20c3fea9d950d14157438918b8ba8e7747505f71/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/FileUploadDirectives.scala#L192

Maybe, we could just remove the shutdown hook.

fyi @mdedetrich

Rename package from `akka` to `org.apache.pekko`.

We should rename the package from akka to org.apache.pekko. This has somewhat higher priority specifically for this pekko module because we already have non trivial PR's open against it and to respect other peoples time we should finalize the directory structure of the project so that we aren't asking authors of PR's to do major rebase's to resolve merge conflicts against main branch.

Due to pekko-http's usage of private[akka], its not possible to change the packages without some hacky workarounds because in changing the package to org.apache.pekko you can no longer access the private[akka] internal API's. The more principled and easier way to get around this is to change the dependency to use a pekko nightly/snapshot however this is currently blocked by apache/pekko#107

figure out what to about the shapeless code in the parsing module

  • relates to #35
  • Unlike #1, there is no decision to remove the shapeless code yet.
  • it could be that if #1 is merged, that we no longer need the shapeless code (I haven't checked if the parboiled2 code is the only code using the shapeless code)
  • shapeless3 exists for Scala 3 but does include HList - I guess the logic is that Scala 3 tuples can do the task
  • so if we do use HLIst or the other shapeless code in pekko-http (after #1 is merged or deferred) then we might want to keep the shapeless code
  • if we keep it, we will need to consider updating our LICENSE and NOTICE.
  • relates to #62

Figure out how to use setup-java

The approach in #96 did not quite work.

Probably we are not getting the full-featured sbt launcher but whatever the GHA base image includes.

Move to upstream parboiled2 dependency

Akka HTTP right now contains a copy of parboiled2 in its sources (with some slight additions). This decision was originally made on the grounds that Akka should not have many dependencies on Scala libraries, so it can be released quickly after a new (incompatible) Scala version has been released.

By now, parboiled2 does not depend on shapeless any more and the ecosystem has more stabilized (and after all, maintaining the fork has not helped at all with migration to new Scala versions...). So, I'd suggest we move to upstream parboiled2.

consider using parboiled2 as a jar dependency in v1.0.0

Relates to #35

fix links to pekko-http snapshot javadoc/scaladoc

The current nightly builds publish docs but the links to the javadoc/scaladoc from the reference docs uses the full snapshot version. We do not publish to https://nightlies.apache.org/pekko/docs/pekko-http/main-snapshot/ with the full snapshot version.

Example: See HttpRequest link in https://pekko.apache.org/docs/pekko-http/current/introduction.html#low-level-http-server-apis

Today that links to https://pekko.apache.org/japi/pekko-http/0.0.0+4453-9a48d9fc-SNAPSHOT/org/apache/pekko/http/scaladsl/model/HttpRequest.html

For snapshot builds, can we change the link just to have snapshot instead of the full snapshot version?

So the link above would be https://pekko.apache.org/japi/pekko-http/snapshot/org/apache/pekko/http/scaladsl/model/HttpRequest.html - which works

PoolInterface buffer size regression issue in akka-http 10.2.10

Discussed in #138

Originally posted by jphelp32 April 18, 2023
@jrudolph
can you comment on the likelihood of pekko-http addressing this regression that was introduced in akka-http 10.2.10: akka/akka-http#4132 (comment)
We are currently locked at akka-http 10.2.9 due to this issue. As we're planning our migration to pekko, I'm trying to plan whether to expect a fix in pekko-http, or if we should plan to adjust our configs according to the newer/broken(?) behavior that was introduced in 10.2.10.
thanks

Original akka-http issue: akka/akka-http#4156
Summary:

10.2.10 seems to have changed the semantics of the host connection pool max-open-requests configuration. Consider that N requests to a single host are accepted by Http().singleRequest() before a BufferOverflowException occurs. Prior to the mentioned change, N = max-open-connections. Now after this change, it appears that N = max-open-requests + max-connections.

acknowledge use of jsoniter-scala code in HashCodeCollider

part of #35

docs: decide how to handle the g8 templates

  • do we continue with the existing theIterators templates?
  • if so, should we change how we document the templates in the pekko-http docs (eg moving them to the Examples and Extensions page)
  • do we create Pekko specific ones? This might have implications in terms of having the add license headers, come up with release processes, etc.

remove use of lightbend sbt paradox plugin

  • in short term, we are likely to switch to plain sbt-paradox plugin
  • until we have our own pekko plugin
  • useful to get rid of Lightbend/Akka branding
  • also seems that Lightbend copy of the plugin stops us adding links to other web sites (like the Akka site)

docs: update any Akka specific version numbers

Relates to #33

Unless we need to specifically talk about Akka - in most cases, we will be adjusting the text to talk about Pekko.

Any mentions of Akka 2.6 or Akka HTTP 10.2 (for instance) - need to be changed to refer to Pekko 1.0.0 or Pekko HTTP 1.0.0 respectively.

scaladoc links to java runtime classes are broken

see https://github.com/apache/incubator-pekko-http/actions/runs/5427033437/jobs/9878610786

has issues like:

`[https://docs.oracle.com/en/java/javase/11/docs/api/java/util/Map.html`](https://docs.oracle.com/en/java/javase/11/docs/api/java/util/Map.html) status 404 Not Found
 - ../../../../../target/scala-2.13/unidoc/org/apache/pekko/http/javadsl/model/headers/HttpCredentials.html
 - ../../../../../target/scala-2.13/unidoc/org/apache/pekko/http/javadsl/server/AllDirectives.html
 - ... 3 more

should be https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html

The sbt settings closely match those in incubator-pekko but the scaladoc is generating ok in incubator-pekko

Restore the removed text from `handling-blocking-operations-in-pekko-http-routes.md`

In the #34 PR, specific markdown text was removed from the handling-blocking-operations-in-pekko-http-routes.md file, i.e. https://github.com/apache/incubator-pekko-http/pull/34/files/38af0a2735a3cdf5339490d5f1d3acd910cc65a5#diff-6ff1d12760e28d4b30391860625c906ad82391240593ad8dabd7e93e2c7b571aL69 . Incase you have issues viewing the diff the precise text that was removed is

@java[The same happens to the global @apidoc[ForkJoinPool] when using Java Futures.]

after the however they go to sleep state immediately, thus wasting the resources. sentance.

The reason why the text was removed was that due to the change in that PR in renaming the package from akka to org.apache.pekko, it caused paradox to make a compilation error on that text. Even when trying to use a FQCN i.e.

@java[The same happens to the global @apidoc[java.util.concurrent.ForkJoinPool] when using Java Futures.]

It still didn't compile. I suspect that the root cause is before the package name change, some weird shadowing was going on with the akka package, and because of this the @apidoc[ForkJoinPool] was actually pointing to akka.dispatch.forkjoin.ForkJoinPool and not java.util.concurrent.ForkJoinPool (which I think is incorrect judging from the context of whats being described).

HTTP/2 error when parsing percent-encoded query string

Very simple reproducer with explanation: https://github.com/mkurz/akka-http-percent-encoding-bug (that reproducer is still based on akka-http but should work 1:1 when applied to pekko-http)

Copy and pasted README (in case I ever delete that repo):

pekko-http's (experimental?) http2 support does not correctly handle URL parsing errors.
Specially when passing an invalid percent-encoded character in the path and/or query string (here %_D):

As reproducer the example from the akka docs can be used, but with HTTP/2 enabled:

# Start the server
sbt run
# HTTP/1 works:
$ curl --http1.1 -v http://localhost:8080/?param=%_D
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /?param=%_D HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.87.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Server: akka-http/10.2.10
< Date: Wed, 15 Feb 2023 16:29:18 GMT
< Connection: close
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 78
< 
* Closing connection 0
Illegal request-target: Invalid input '_', expected HEXDIG (line 1, column 10)
# HTTP/2 gives error:
$ curl --http2-prior-knowledge -v http://localhost:8080/?param=%_D
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
* Using HTTP2, server supports multiplexing
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* h2h3 [:method: GET]
* h2h3 [:path: /?param=%_D]
* h2h3 [:scheme: http]
* h2h3 [:authority: localhost:8080]
* h2h3 [user-agent: curl/7.87.0]
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0xaaabd90f0dc0)
> GET /?param=%_D HTTP/2
> Host: localhost:8080
> user-agent: curl/7.87.0
> accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
* Closing connection 0
curl: (16) Error in the HTTP2 framing layer

At some point, no matter if using HTTP/1 or HTTP/2, the parser ends up here

As you can see it will (also) be looked for pct-encoded characters, which expect a % sign, followed by two HEXDIG signs:

Now if that fails...

  • ...when using HTTP/1...

...then the method parseHttpRequestTarget fails with (=throws) an IllegalUriException, which will later be handled so a 400 Bad Request with following body will be send:

Illegal request-target: Invalid input '_', expected HEXDIG (line 1, column 10)

(There are various places in the http-core module where IllegalUriExceptions and ParsingExceptions are caught and handled)

  • ...when using HTTP/2...

PathAndQuery.parse in following line throws an ParsingException which is never handled (this is in the org.apache.pekko.http.impl.engine.http2 package, so not used by HTTP/1):

A couple of lines later only an IOException gets caught:

If you see where the containing method parseAndEmit gets called, the ParsingException never gets handled.

Expected Result

When using HTTP/2 I would expect to also receive a 400 Bad Request with the body:

Illegal request-target: Invalid input '_', expected HEXDIG (line 1, column 10)

Scala 3 only: `java.lang.NoSuchMethodError: ...TLSProtocol$SessionBytes$.unapply(...)`

This scripted test, migrated to pekko in playframework/playframework#11847

  • Works fine with Scala 2.13 ✔️
  • Fails with Scala 3 ❌

Seems like this has to do with how unapply methods changed in Scala 3 (?)

Snapshot used:

  • pekko-http: 0.0.0+4411-6fe04045-SNAPSHOT
  • pekko: 0.0.0+26669-ec5b6764-SNAPSHOT
[error] Uncaught error from thread [application-pekko.actor.default-dispatcher-4]: 'org.apache.pekko.stream.TLSProtocol$SessionBytes org.apache.pekko.stream.TLSProtocol$SessionBytes$.unapply(org.apache.pekko.stream.TLSProtocol$SessionBytes)', shutting down JVM since 'pekko.jvm-exit-on-fatal-error' is enabled for ActorSystem[application]
[error] java.lang.NoSuchMethodError: 'org.apache.pekko.stream.TLSProtocol$SessionBytes org.apache.pekko.stream.TLSProtocol$SessionBytes$.unapply(org.apache.pekko.stream.TLSProtocol$SessionBytes)'
[error]         at org.apache.pekko.http.impl.engine.http2.ProtocolSwitch$$anon$1$$anon$2.onPush(ProtocolSwitch.scala:65)
[error]         at org.apache.pekko.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:555)
[error]         at org.apache.pekko.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:433)
[error]         at org.apache.pekko.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:662)
[error]         at org.apache.pekko.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:532)
[error]         at org.apache.pekko.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:637)
[error]         at org.apache.pekko.stream.impl.fusing.ActorGraphInterpreter.org$apache$pekko$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:813)
[error]         at org.apache.pekko.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:831)
[error]         at org.apache.pekko.actor.Actor.aroundReceive(Actor.scala:547)
[error]         at org.apache.pekko.actor.Actor.aroundReceive$(Actor.scala:545)
[error]         at org.apache.pekko.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:729)
[error]         at org.apache.pekko.actor.ActorCell.receiveMessage(ActorCell.scala:590)
[error]         at org.apache.pekko.actor.ActorCell.invoke(ActorCell.scala:557)
[error]         at org.apache.pekko.dispatch.Mailbox.processMailbox(Mailbox.scala:280)
[error]         at org.apache.pekko.dispatch.Mailbox.run(Mailbox.scala:241)
[error]         at org.apache.pekko.dispatch.Mailbox.exec(Mailbox.scala:253)
[error]         at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[error]         at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
[error]         at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
[error]         at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
[error]         at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

Line triggering the exception:
https://github.com/apache/incubator-pekko-http/blob/0dc1da23cc465d8795f33daa513298afc2841ab5/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/ProtocolSwitch.scala#L65

SessionBytes:

  final case class SessionBytes(session: SSLSession, bytes: ByteString)
      extends SslTlsInbound
      with scaladsl.ScalaSessionAPI

scaladsl.ScalaSessionAPI:
https://github.com/apache/incubator-pekko/blob/main/stream/src/main/scala/org/apache/pekko/stream/scaladsl/TLS.scala#L249-L294

In case it's needed, if you want to run the scripted tests yourself let me know, so I can give instructions. see comment below

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.