profile
viewpoint
Actix actix https://actix.rs Actix - web and actor frameworks for Rust

actix/actix-web 9555

Actix web is a powerful, pragmatic, and extremely fast web framework for Rust.

actix/actix 5693

Actor framework for Rust.

actix/examples 1440

Community showcase and examples of Actix ecosystem usage.

actix/actix-net 360

Framework for composable networking services.

actix/book 125

Actix user guides

actix/actix-extras 113

A collection of additional crates supporting the actix and actix-web frameworks.

actix/actix-redis 101

Redis actor and middleware for Actix

actix/actix-website 86

The Actix Web website.

actix/actix-remote 80

Distributed actors for actix framework.

actix/actix-web-httpauth 79

Moved to actix-extras repo.

startedactix/actix-web

started time in 2 hours

issue commentactix/actix-web

Can actix_web client run in multiple threads?

  1. Since you are using atcix::main macro. It means you are running on a single thread runtime. calling tokio::task::spawn would not make your task run on other threads.

  2. tokio::task::spawn requires the future you spawn on it have Send bound and it's not possible for actix_web::client::Client because it's not a Send bound type.

  3. most async runtimes in Rust use M:N scheduling. It means they don't spawn new threads with every spawn function.

flyinmind

comment created time in 4 hours

startedactix/actix-net

started time in 4 hours

pull request commentactix/actix-net

Add support of tokio-compat executor

I like the idea of going runtime independent but we have too much tokio dep inside various modules. It would require a major rework far beyond actix-rt itself. So I personally think a good timing for that could be when AsyncRead/Write land in std and even after global executor land too.

popzxc

comment created time in 4 hours

pull request commentactix/actix-web

Add `web::ReqData<T>` extractor

Codecov Report

Merging #1748 into master will increase coverage by 0.22%. The diff coverage is 90.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1748      +/-   ##
==========================================
+ Coverage   53.60%   53.83%   +0.22%     
==========================================
  Files         126      127       +1     
  Lines       11996    12050      +54     
==========================================
+ Hits         6431     6487      +56     
+ Misses       5565     5563       -2     
Impacted Files Coverage Δ
src/data.rs 93.51% <ø> (ø)
src/lib.rs 68.42% <ø> (ø)
src/web.rs 85.71% <ø> (ø)
src/request_data.rs 90.74% <90.74%> (ø)
src/service.rs 81.01% <0.00%> (+1.38%) :arrow_up:
src/request.rs 95.25% <0.00%> (+1.58%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 98243db...aa726ba. Read the comment docs.

robjtede

comment created time in 5 hours

push eventactix/actix-web

Rob Ede

commit sha aa726ba8d9371805d42c3ecdb2332ff90524549c

tweak example docs

view details

push time in 6 hours

push eventactix/actix-web

Rob Ede

commit sha 32b4184530e362bc7abdfcdabac22a1bfe2e67b2

fix example comment

view details

push time in 6 hours

push eventactix/actix-web

Rob Ede

commit sha 081c207ab7cd8f27b8a7b02acd76de7d9b04bf3b

fix intra doc links

view details

push time in 6 hours

push eventactix/actix-web

Rob Ede

commit sha 79322fe6086c1014a05cff0fc8480b98c98e02db

amend PR number

view details

push time in 6 hours

push eventactix/actix-web

Jonas Platte

commit sha d765e9099dbda47831a72d3fa149ec03f4e37576

Fix clippy::rc_buffer (#1728)

view details

Yuki Okushi

commit sha 2f8491414604c397754c9ab18c0028aa46002194

Skip some tests that cause ICE on nightly (#1740)

view details

Matt Gathu

commit sha cfd5b381f13937bb00be6bc427c8687a5f5b9732

Implement Logger middleware regex exclude pattern (#1723) Co-authored-by: Rob Ede <robjtede@icloud.com>

view details

Rob Ede

commit sha e563025b1644be0d332eba381745fd47e5b626ef

always construct shortslice using debug checked new constructor (#1741)

view details

ghizzo01

commit sha f92742bdacfab73b4df3b5c995ad67290a311f8f

Bump base64 to 0.13 (#1744)

view details

cquintana-verbio

commit sha 98243db9f102627550bacbeced0f2b197a0ad51a

Print unconfigured `Data<T>` type when attempting extraction (#1743) Co-authored-by: Rob Ede <robjtede@icloud.com>

view details

Jonas Platte

commit sha cb60d026c70f047d953fe736e9dbf9012727c36f

Improve docs for Data extractor

view details

Jonas Platte

commit sha e39775f791cc7dfcce556556d93afc689f903275

Add web::ReqData

view details

Rob Ede

commit sha 51dd959c50c909429e0ef3a3903070a8156353e2

add tests and improve docs

view details

push time in 6 hours

PR closed actix/actix-web

Add web::ReqData extractor P-web semver-minor

PR Type

Feature

PR Checklist

  • [ ] Tests for the changes have been added / updated.
  • [ ] Documentation comments have been added / updated.
  • [ ] A changelog entry has been made for the appropriate packages.
  • [x] Format code with the latest stable rustfmt

Overview

Adds a ReqData extractor for request data / request extensions, analogous to web::Data.

+59 -13

4 comments

4 changed files

jplatte

pr closed time in 6 hours

pull request commentactix/actix-web

Add web::ReqData extractor

I didn't seem to be able to push to this branch so created a new PR that includes the original commits. Closing this one.

jplatte

comment created time in 6 hours

PR opened actix/actix-web

Add web::ReqData extractor P-web semver-minor

PR Type

Feature

PR Checklist

  • [x] Tests for the changes have been added / updated.
  • [x] Documentation comments have been added / updated.
  • [x] A changelog entry has been made for the appropriate packages.
  • [x] Format code with the latest stable rustfmt

Overview

Superceeds #1729 but includes original commits by @jplatte.

Adds a ReqData extractor for request data / request extensions, analogous to web::Data.

Changes from original:

  • remove DerefMut impl
    • i see this as a footgun, devs may infer that data is mutated in place (in the extensions map)
  • make inner field private
    • matches Data
    • can always be make pub but not the other way without breaking change
  • provide an into_inner
  • improve docs
    • adding an example
    • clarify that data is cloned

Future work:

  • support unsized
  • mention possibility of Rc<RefCell<T>> in docs for in-place mutation (theres a test demonstrating this)
+193 -21

0 comment

5 changed files

pr created time in 6 hours

create barnchactix/actix-web

branch : req-data

created branch time in 6 hours

delete branch actix/actix-web

delete branch : req-data

delete time in 6 hours

create barnchactix/actix-web

branch : req-data

created branch time in 6 hours

startedactix/actix

started time in 9 hours

startedactix/actix-web

started time in 10 hours

startedactix/actix-web

started time in 11 hours

PR opened actix/actix

Remove return value from Recipient::do_send

do_send() is supposed to be the fire and forget way of sending, as opposed to try_send(). This change aligns the signatures of Addr::do_send and Recipient::do_send().

<!-- Thanks for considering contributing actix! --> <!-- Please fill out the following to make our reviews easy. -->

PR Type

<!-- What kind of change does this PR make? --> <!-- Bug Fix / Feature / Refactor / Code Style / Other --> Refactor

PR Checklist

Check your PR fulfills the following:

<!-- For draft PRs check the boxes as you complete them. -->

  • [ ] Tests for the changes have been added / updated.
  • [ ] Documentation comments have been added / updated.
  • [ ] A changelog entry has been made for the appropriate packages.
  • [ ] Format code with the latest stable rustfmt

Overview

<!-- Describe the current and new behavior. --> <!-- Emphasize any breaking changes. -->

<!-- If this PR fixes or closes an issue, reference it here. --> Closes #440

+3 -2

0 comment

1 changed file

pr created time in 11 hours

startedactix/actix-web

started time in 11 hours

push eventactix/actix-web

robjtede

commit sha f20265f6dae62aee5da716d7a0762e785a2a3d7f

Deploying to gh-pages from @ 98243db9f102627550bacbeced0f2b197a0ad51a 🚀

view details

push time in 12 hours

push eventactix/actix-web

cquintana-verbio

commit sha 98243db9f102627550bacbeced0f2b197a0ad51a

Print unconfigured `Data<T>` type when attempting extraction (#1743) Co-authored-by: Rob Ede <robjtede@icloud.com>

view details

push time in 12 hours

PR merged actix/actix-web

Print unconfigured `Data<T>` type when attempting extraction P-web semver-minor

<!-- Thanks for considering contributing actix! --> <!-- Please fill out the following to make our reviews easy. -->

PR Type

<!-- What kind of change does this PR make? --> <!-- Bug Fix / Feature / Refactor / Code Style / Other --> Other

PR Checklist

Check your PR fulfills the following:

<!-- For draft PRs check the boxes as you complete them. -->

  • [x] A changelog entry has been made for the appropriate packages.
  • [X] Format code with the latest stable rustfmt

Overview

<!-- Describe the current and new behavior. --> This PR aims to help developers when facing the

Failed to construct App-level Data extractor. Request path: "/your-endpoint"

Now, it will print something like the following:

Failed to construct App-level Data extractor. Request path: "/your-endpoint" (type = THE_TYPE_WILL_APPEAR_HERE)

<!-- Emphasize any breaking changes. -->

<!-- If this PR fixes or closes an issue, reference it here. --> <!-- Closes #000 -->

+6 -2

1 comment

2 changed files

cquintana-verbio

pr closed time in 12 hours

issue commentactix/actix-web

awc 2 does not follow redirects by default, contradicting documentation

Some notes based research I've done so far:

  • This MDN article is a great reference for the semantics of each redirect type (there are a few and some of them are kinda funky).
  • For security reasons, we should detect cross-origin redirects and omit sensitive headers.
  • If we can, request bodies should be re-used but it's okay to document a known limitation that streamed request bodies are not resent in redirects.
Shnatsel

comment created time in 12 hours

startedactix/actix-web

started time in 12 hours

PR closed actix/actix-web

Deprecate functions for following redirects

<!-- Thanks for considering contributing actix! --> <!-- Please fill out the following to make our reviews easy. -->

PR Type

<!-- What kind of change does this PR make? --> <!-- Bug Fix / Feature / Refactor / Code Style / Other --> Documentation

PR Checklist

<!-- For draft PRs check the boxes as you complete them. -->

  • [x] Documentation comments have been added / updated.
  • [ ] A changelog entry has been made for the appropriate packages.
  • [x] Format code with the latest stable rustfmt

Overview

I'm planning on adding support for following redirects. For the time being, here's a PR that adds deprecation notices to the builder functions that reference redirects since they are effectively no-ops for the time being.

Related to #1571

+4 -8

3 comments

1 changed file

thiagoarrais

pr closed time in 12 hours

pull request commentactix/actix-web

Deprecate functions for following redirects

I think so, for now. If we don't see redirects coming soonish then we'll deprecate them. My hope is that now it has attention it can get coded up pretty quick.

thiagoarrais

comment created time in 12 hours

pull request commentactix/actix-web

Print unconfigured `Data<T>` type when attempting extraction

Codecov Report

Merging #1743 into master will increase coverage by 0.00%. The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1743   +/-   ##
=======================================
  Coverage   53.60%   53.60%           
=======================================
  Files         128      126    -2     
  Lines       11997    11996    -1     
=======================================
  Hits         6431     6431           
+ Misses       5566     5565    -1     
Impacted Files Coverage Δ
src/data.rs 93.51% <0.00%> (-0.88%) :arrow_down:
actix-http/src/header/common/accept_language.rs
actix-http/src/header/common/accept_charset.rs
actix-http/src/header/common/last_modified.rs
actix-http/src/header/common/content_language.rs 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f92742b...ec8e66e. Read the comment docs.

cquintana-verbio

comment created time in 12 hours

pull request commentactix/actix-web

Deprecate functions for following redirects

I've made this one just in case I couldn't finish the real redirect one. This way HEAD at least is consistent.

Feel free to close this if you wish.

thiagoarrais

comment created time in 12 hours

PullRequestReviewEvent

pull request commentactix/actix-web

Deprecate functions for following redirects

Do you think it's worth doing this. I assume you'll be adding them back straight away if you're intending to tackle adding in redirect support?

thiagoarrais

comment created time in 13 hours

PullRequestReviewEvent

Pull request review commentactix/actix-web

Print unconfigured AppData type

  ## Unreleased - 2020-xx-xx * Implement Logger middleware regex exclude pattern [#1723]+* Print unconfigured AppData type [#1743]
* Print unconfigured `Data<T>` type when attempting extraction. [#1743]
cquintana-verbio

comment created time in 13 hours

PullRequestReviewEvent

startedactix/actix-web

started time in 14 hours

startedactix/actix-web

started time in 14 hours

issue openedactix/actix-web

Can actix_web client run in multiple threads?

For example, realize a benchmark tool with actix-web client. Run several clients in different thread. But failed to compile it,

let h = tokio::task::spawn(async move { | ^^^^^^^^^^^^^^^^^^ future created by async block is not Send

Maybe ClientResponse has not implemented Send, so it failed. Anyone know how to realize the function with actix-web client? thanks!

use actix_web::client::Client; use std::time::SystemTime; use actix::prelude::*; use tokio::task::{self, JoinHandle}; use std::sync::Arc;

const threadNum : usize = 8; const runTimes : u64 = 5;

#[actix_web::main] async fn main() { let start = SystemTime::now(); let mut i : usize = 0; //let sys = actix::System::new("test"); let mut handlers = Vec::<task::JoinHandle<usize>>::with_capacity(threadNum); let client = Client::default();

while i < threadNum {
    i += 1;
    let no = i;
    let h = tokio::task::spawn(async move {
        test127(no).await
    });
    handlers.push(h);
}

let mut errNum : usize = 0;
for h in handlers {
    errNum += h.await.unwrap();
}
//sys.run();
let interval = start.elapsed().unwrap().as_millis() as u64;

println!("thread-num:{},use-time:{} ms,speed:{}, failed:{}", 
    threadNum, interval, runTimes * 1000 * (threadNum as u64) / interval, errNum);

}

async fn test127(threadNo : usize) -> usize { let client = Client::default(); let mut errNum :usize = 0; let mut i : u64 = 0; while i < runTimes { i += 1; // Create request builder and send request

    let req = client.get("http://127.0.0.1:8080");

    match req.send().await { // <- Wait for response
        Ok(mut response) => {
            match response.body().await {
                Ok(buf) => {
                    println!("Response: {},{}", String::from_utf8(buf.to_vec()).unwrap(), threadNo);
                }
                Err(e) => {
                    errNum += 1;
                    //println!("Fail to get body, error:{:?}", &e);
                }
            }
        }
        Err(e) => {
            errNum += 1;
            //println!("Fail to get resposne, error:{:?}", &e);
        }  
    }
}
errNum

}

created time in 15 hours

startedactix/examples

started time in 17 hours

startedactix/actix-web

started time in 17 hours

startedactix/actix-web

started time in 18 hours

issue commentactix/actix-web

Logger Middleware - Allow certain endpoints to be excluded from logging

I switched to log4rs. Problem solved.

glademiller

comment created time in 18 hours

startedactix/actix

started time in 19 hours

startedactix/actix-web

started time in 19 hours

startedactix/examples

started time in 20 hours

startedactix/actix-net

started time in a day

startedactix/actix-extras

started time in a day

push eventactix/actix

JohnTitor

commit sha 3a62b3add2eecb497c7ad9d23d44158d53b27c01

Deploying to gh-pages from @ 09848fa32b9663175782c9cf8909c1ce82cef1a7 🚀

view details

push time in a day

pull request commentactix/actix

enable nested sync arbiters

Thanks <3

fakeshadow

comment created time in a day

push eventactix/actix

fakeshadow

commit sha 09848fa32b9663175782c9cf8909c1ce82cef1a7

enable nested sync arbiters (#439)

view details

push time in a day

PR merged actix/actix

enable nested sync arbiters

<!-- Thanks for considering contributing actix! --> <!-- Please fill out the following to make our reviews easy. -->

PR Type

<!-- What kind of change does this PR make? --> <!-- Bug Fix / Feature / Refactor / Code Style / Other --> Bug Fix

PR Checklist

Check your PR fulfills the following:

<!-- For draft PRs check the boxes as you complete them. -->

  • [x] Tests for the changes have been added / updated.
  • [x] Documentation comments have been added / updated.
  • [x] A changelog entry has been made for the appropriate packages.
  • [x] Format code with the latest stable rustfmt

Overview

<!-- Describe the current and new behavior. --> <!-- Emphasize any breaking changes. --> Not sure if this can be considered a bug but sync arbiter would want to spawn on current thread arbiter. This means spawn nested sync arbiter would not work and no panic or error is shown.

This PR send the sync arbiter to current system and spawn it there to work around the requirement of current thread arbiter.

<!-- If this PR fixes or closes an issue, reference it here. --> <!-- Closes #000 --> Closes #434

+62 -4

3 comments

3 changed files

fakeshadow

pr closed time in a day

issue closedactix/actix

SyncActor started from another SyncActor does not get messages

I am not sure whether it is a bug or I do not understand it correctly, but if I run a SyncActor from another SyncActor, the second one does not get messages. The minimum example is below: the SyncActor2 never gets the message (Msg2).

use actix::prelude::*;

struct SyncActor2;

impl Actor for SyncActor2 {
    type Context = SyncContext<Self>;
}

struct SyncActor1(Addr<SyncActor2>);

impl Actor for SyncActor1 {
    type Context = SyncContext<Self>;
}

impl SyncActor1 {
    fn run() -> SyncActor1 {
        SyncActor1(SyncArbiter::start(1, || SyncActor2))
    }
}

struct Msg1;

impl Message for Msg1 {
    type Result = ();
}

struct Msg2;

impl Message for Msg2 {
    type Result = ();
}

impl Handler<Msg1> for SyncActor1 {
    type Result = ();
    
    fn handle(&mut self, _: Msg1, _: &mut Self::Context) -> Self::Result {
        self.0.do_send(Msg2);
        println!("SyncActor1 got the message");
    }
}

impl Handler<Msg2> for SyncActor2 {
    type Result = ();
    
    fn handle(&mut self, _: Msg2, _: &mut Self::Context) -> Self::Result {
        println!("SyncActor2 got the message either");
    }
}

#[actix_rt::main]
async fn main() {
    let addr = SyncArbiter::start(1, || SyncActor1::run());
    addr.send(Msg1).await.unwrap();
    tokio::signal::ctrl_c().await.unwrap();
    println!("Ctrl-C received, shutting down");
    System::current().stop();
}

closed time in a day

satarsa

startedactix/actix-web

started time in a day

startedactix/actix

started time in a day

startedactix/actix-web

started time in a day

startedactix/actix

started time in a day

issue commentactix/actix-web

Logger Middleware - Allow certain endpoints to be excluded from logging

Basically I added it, because I wanted to stop logging. It also traces (if app level is trace) independently of whether I issue the wrap call or not. This was just an attempt.

Unfortunately I can't use env_logger, which seems to not be able to log to file. Maybe I drop simplelog too in favour of log4j. Thank you for your offer, but it is rather late over here, I will stop for today 👍

glademiller

comment created time in a day

startedactix/actix

started time in a day

issue commentactix/actix-web

Logger Middleware - Allow certain endpoints to be excluded from logging

The logger middleware is specifically for logging request statuses as you might see in nginx or apache logs, for instance. So if you don't want these logs simply omit the .wrap(Logger) call.

If I've misunderstood @ me in the Gitter chat and we can continue there.

glademiller

comment created time in a day

issue commentactix/actix-web

Logger Middleware - Allow certain endpoints to be excluded from logging

Hi @robjtede and thanks for the super quick reply. Yes, I have seen the env configuration to configure env_logger, but those don't apply. So I have to continue searching. I tried to

.wrap(Logger::new(""))

This was accepted, but in the end it just created empty "INFO" traces, whenever something happened on the network :)

glademiller

comment created time in a day

push eventactix/examples

Rob Ede

commit sha 5573e5fd34c853a160865df3abf4da6db48e2aaf

update cors example to 0.5

view details

push time in a day

issue commentactix/actix-web

Logger Middleware - Allow certain endpoints to be excluded from logging

@neilyoung I don't know if simplelogger has the ability to filter out specific logs. With env_logger, for example, you can say RUST_LOG=info,my_crate=trace cargo run to only show trace logs from your own project.

glademiller

comment created time in a day

issue commentactix/actix-web

Logger Middleware - Allow certain endpoints to be excluded from logging

Sorry for bringing up this again. I would like to stop actix from logging at all. I'm using log and simplelog and if my application log level goes up to trace, actix really heavily logs and I currently don't know, how to stop that. I admit, it is possible, that I didn't understand it all :)

22:27:20 [TRACE] (9) actix_server::worker: [/Users/decades/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-server-1.0.4/src/worker.rs:263] Service "actix-web-service-0.0.0.0:5000" is available
22:27:20 [TRACE] (6) actix_web::middleware::logger: [/Users/decades/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-3.1.0/src/middleware/logger.rs:314] Access log format: %a "%r" %s %b "%{Referer}i" "%{Use
glademiller

comment created time in a day

created tagactix/actix-extras

tagcors-0.5.0

A collection of additional crates supporting the actix and actix-web frameworks.

created time in a day

release actix/actix-extras

cors-0.5.0

released time in a day

push eventactix/actix-extras

Rob Ede

commit sha 76429602c6545bde0f9094665705f52334360e72

prepare cors release 0.5.0

view details

push time in a day

startedactix/examples

started time in a day

startedactix/actix-web

started time in a day

startedactix/actix-web

started time in a day

startedactix/actix-web

started time in a day

startedactix/actix-web

started time in a day

issue closedactix/actix-web

Fails to build with mongodb in docker alpine

Expected Behavior

Successfull build

Current Behavior

Fails to build an alpine docker container (getting the same issue in debian) consuming all the RAM available at the machine (memory consuming constantly increasing until it reaches 32Gb).

But build is successful locally on arch consuming maximum about 0.5 Gb of memory. Local rust version (stable works as well):

rustc 1.47.0-nightly (6c8927b0c 2020-07-26)

Possible Solution

Not sure where to start and how to debug it. Removing one of actix-web or mongodb dependencies works, but using them together doesn't.

Steps to Reproduce (for bugs)

main.rs:

use actix_web::{web, App, HttpResponse, HttpServer};
use mongodb::Client;
use schema::OperationOutcome;
use std::env;
use std::sync::Mutex;

pub mod issues;
pub mod schema;
pub mod server;

pub mod fhir {
    tonic::include_proto!("fhir");
}

#[derive(Clone)]
struct AppState {
    mongo: web::Data<Mutex<Client>>,
    db: String,
}

async fn health() -> HttpResponse {
    HttpResponse::Ok().finish()
}

async fn expand(data: web::Data<AppState>, web::Path(id): web::Path<String>) -> HttpResponse {
    let db = data.mongo.lock().unwrap().database(data.db.as_str());
    match server::value_set::expand(&db, &id).await {
        Ok(value_set) => HttpResponse::Ok().json(value_set),
        Err(error_response) => HttpResponse::Ok().json(OperationOutcome {
            issue: error_response.issue,
        }),
    }
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    let port: u64 = env::var("PORT")
        .unwrap_or(String::from("4000"))
        .parse()
        .unwrap();

    let db_url = env::var("DB_URL").unwrap_or(String::from("mongodb://localhost:27017"));
    let db = env::var("DB").unwrap_or(String::from("terminology_test"));
    let client = web::Data::new(Mutex::new(
        Client::with_uri_str(db_url.as_str()).await.unwrap(),
    ));

    HttpServer::new(move || {
        App::new()
            .data(AppState {
                mongo: client.clone(),
                db: db.clone(),
            })
            .route("/health", web::get().to(health))
            .route("/ValueSet/{id}/$expand", web::get().to(expand))
    })
    .bind(format!("0.0.0.0:{}", port))?
    .run()
    .await
}

Context

Dockerfile:

FROM rust:1.47-alpine as builder
RUN apk add --no-cache musl-dev protoc openssl-dev
ADD  . /app
WORKDIR /app
ENV PROTOC=/usr/bin/protoc
RUN rustup component add rustfmt
RUN cargo install --locked --path .

FROM alpine:3.12
COPY --from=builder /usr/local/cargo/bin/fhir_terminology_server /app/terminology
EXPOSE 4000
CMD ["/app/terminology"]

<!--- How has this issue affected you? What are you trying to accomplish? --> <!--- Providing context helps us come up with a solution that is most useful in the real world -->

Your Environment

Cargo.toml:

[dependencies]
tonic = "0.3.0"
prost = "0.6.1"
actix-web = "3.1.0"
serde = {version = "1.0", features = ["derive"]}
serde_json = "1.0"
mongodb = "1.1.1"
tokio = {version = "0.3.0", features = ["stream"]}

[build-dependencies]
tonic-build = "0.3.0"

Any ideas what can cause such weird behavior in docker only?

closed time in a day

AlexKovalevych

issue commentactix/actix-web

Fails to build with mongodb in docker alpine

Yup, it works with Rust 1.45, but doesn't work with 1.46, 1.47, so it's a duplicate

AlexKovalevych

comment created time in a day

delete branch actix/actix-extras

delete branch : feat/cors-origin-fn-param

delete time in a day

push eventactix/actix-extras

Rob Ede

commit sha f20b7248302a7542af83c700608d7b80e4c1a6d4

cors origin validator function receives origin as first parameter (#120)

view details

push time in a day

PR merged actix/actix-extras

cors origin validator function receives origin as first parameter P-cors semver-major

PR Type

Featuer

PR Checklist

  • [x] Tests for the changes have been added / updated.
  • [x] Documentation comments have been added / updated.
  • [x] A changelog entry has been made for the appropriate packages.
  • [x] Format code with the latest stable rustfmt

Overview

Makes most common validate-by-function operations simpler by providing the extracted origin as the first parameter to validator functions.

Closes #115.

+44 -26

1 comment

7 changed files

robjtede

pr closed time in a day

issue closedactix/actix-extras

tracking cors 1.0 promotion

Should be pretty easy to get actix-cors in a 1.0 state since it's feature complete.

  • [x] panic on wildcard origin #114
  • [x] clean up docs about when panic occurs
  • [x] consider removing CorsFactory #119
  • [x] address any other open issues
  • [x] is disable_preflight needed?
    • im sure someone out there has a use case
    • could consider adding a deprecation notice in v1 asking anyone with a use case can open an issue
  • [x] is send_wildcard needed?
    • we'll leave it but it's not very useful in today's web world
  • [x] allowed_origin_fn without allowed_origin bug fixed in #119
  • [x] pass origin header down as parameter to allow origin fns (+ optimise origin extraction) [#120]
  • [x] should CorsError be public?
    • there is probably a use case somewhere for wanting to manually return these error, in which case having the pre-built ErrorResponse impls could be useful.

closed time in a day

robjtede
PullRequestReviewEvent
PullRequestReviewEvent

push eventactix/actix

JohnTitor

commit sha ffce90ee39e953141ee421c213040cca8e50612d

Deploying to gh-pages from @ 9892dda5d1ed861bb4471a80579d8e8ff444c08f 🚀

view details

push time in a day

pull request commentactix/actix

Add WeakRecipient (v2)

Thanks all!

hoodie

comment created time in a day

push eventactix/actix

Hendrik Sollich

commit sha 9892dda5d1ed861bb4471a80579d8e8ff444c08f

Add WeakRecipient (v2) (#432) Co-authored-by: Jonathas Conceição <jadoliveira@inf.ufpel.edu.br> Co-authored-by: Rob Ede <robjtede@icloud.com>

view details

push time in a day

PR merged actix/actix

Add WeakRecipient (v2)

With this change you can now call .recipient() on WeakAddr<A> just like on Addr<A>. In this case you get a WeakRecipient<M> that can be upgraded to a Recipient<M>.

<!-- Thanks for considering contributing actix! --> <!-- Please fill out the following to make our reviews easy. -->

PR Type

<!-- What kind of change does this PR make? --> <!-- Bug Fix / Feature / Refactor / Code Style / Other --> INSERT_PR_TYPE

PR Checklist

Check your PR fulfills the following:

<!-- For draft PRs check the boxes as you complete them. -->

  • [x] Tests for the changes have been added / updated.
  • [x] Documentation comments have been added / updated.
  • [x] A changelog entry has been made for the appropriate packages.
  • [x] Format code with the latest stable rustfmt

Overview

Hi there, I'm trying to convert my project to make greater use of Recipient<M> instead of Addr<A> since I believe it allows to loosen some tight coupling here and there. Unfortunately there is no equivalent to WeakAddr<A> for Recipients yet, so I cannot really use Recipients at the moment without running the risk of leaking objects. Therefore I would like to suggest adding WeakRecipients to actix.

This PR supersedes #418, which was flawed. In that attempt I made the Box inside the Recipient an Arc and downgraded it. you would call

let weak_rcp = my_actor.addr().recipient().downgrade();

That however meant that you the WeakRecipient was invalidated immediately. In this second attempt I'm creating the WeakRecipient from an existing WeakAddr.

let weak_rcp = my_actor.addr().downgrade().recipient();

Thank you very much for your review.

+454 -5

10 comments

7 changed files

hoodie

pr closed time in a day

startedactix/actix

started time in a day

Pull request review commentactix/actix-web

use idenity encoding on client if no compression features are enabled

 # Changes  ## Unreleased - 2020-xx-xx-* Implement Logger middleware regex exclude pattern [#1723] +* Implement Logger middleware regex exclude pattern [#1723]

-> 06841e111c58a30537455fb2e0ba8e72df0ffcfe

j-brn

comment created time in a day

PullRequestReviewEvent

Pull request review commentactix/actix-web

use idenity encoding on client if no compression features are enabled

 # Changes  ## Unreleased - 2020-xx-xx-* Implement Logger middleware regex exclude pattern [#1723] +* Implement Logger middleware regex exclude pattern [#1723] [#1723]: https://github.com/actix/actix-web/pull/1723 +### Fixed++* awc now uses `Accept-Encoding: identity` instead of `Accept-Encoding: br` when no compression feature is enabled+[#1737](https://github.com/actix/actix-web/pull/1737)+

-> 06841e111c58a30537455fb2e0ba8e72df0ffcfe

j-brn

comment created time in a day

PullRequestReviewEvent

push eventactix/actix-web

robjtede

commit sha 472cd05a6c8dd3a4f21ba4d7e56ff5738873d4e4

Deploying to gh-pages from @ f92742bdacfab73b4df3b5c995ad67290a311f8f 🚀

view details

push time in a day

push eventactix/actix-web

ghizzo01

commit sha f92742bdacfab73b4df3b5c995ad67290a311f8f

Bump base64 to 0.13 (#1744)

view details

push time in a day

PR merged actix/actix-web

Bump base64 to 0.13 P-awc P-http P-test-server semver-patch

split off from #1733

+6 -5

2 comments

6 changed files

ghizzo01

pr closed time in a day

PullRequestReviewEvent

startedactix/examples

started time in a day

Pull request review commentactix/actix-web

use idenity encoding on client if no compression features are enabled

 # Changes  ## Unreleased - 2020-xx-xx-* Implement Logger middleware regex exclude pattern [#1723] +* Implement Logger middleware regex exclude pattern [#1723]

undo the diff noise

j-brn

comment created time in a day

PullRequestReviewEvent

Pull request review commentactix/actix-web

use idenity encoding on client if no compression features are enabled

 # Changes  ## Unreleased - 2020-xx-xx-* Implement Logger middleware regex exclude pattern [#1723] +* Implement Logger middleware regex exclude pattern [#1723] [#1723]: https://github.com/actix/actix-web/pull/1723 +### Fixed++* awc now uses `Accept-Encoding: identity` instead of `Accept-Encoding: br` when no compression feature is enabled+[#1737](https://github.com/actix/actix-web/pull/1737)+

this should be in awc/CHANGEs.md

j-brn

comment created time in a day

PullRequestReviewEvent

issue commentactix/actix-web

Fails to build with mongodb in docker alpine

Can you check if this works on any rustc version pre 1.46. If so, this is a duplicate of 1688.

AlexKovalevych

comment created time in a day

issue commentactix/actix-web

Fails to build with mongodb in docker alpine

Looks similar https://github.com/actix/actix-web/issues/1688, but it works for me locally

AlexKovalevych

comment created time in a day

issue openedactix/actix-web

Fails to build with mongodb in docker alpine

Expected Behavior

Successfull build

Current Behavior

Fails to build an alpine docker container (getting the same issue in debian) consuming all the RAM available at the machine (memory consuming constantly increasing until it reaches 32Gb).

But build is successful locally on arch consuming maximum about 0.5 Gb of memory. Local rust version (stable works as well):

rustc 1.47.0-nightly (6c8927b0c 2020-07-26)

Possible Solution

Not sure where to start and how to debug it. Removing one of actix-web or mongodb dependencies works, but using them together doesn't.

Steps to Reproduce (for bugs)

main.rs:

use actix_web::{web, App, HttpResponse, HttpServer};
use mongodb::Client;
use schema::OperationOutcome;
use std::env;
use std::sync::Mutex;

pub mod issues;
pub mod schema;
pub mod server;

pub mod fhir {
    tonic::include_proto!("fhir");
}

#[derive(Clone)]
struct AppState {
    mongo: web::Data<Mutex<Client>>,
    db: String,
}

async fn health() -> HttpResponse {
    HttpResponse::Ok().finish()
}

async fn expand(data: web::Data<AppState>, web::Path(id): web::Path<String>) -> HttpResponse {
    let db = data.mongo.lock().unwrap().database(data.db.as_str());
    match server::value_set::expand(&db, &id).await {
        Ok(value_set) => HttpResponse::Ok().json(value_set),
        Err(error_response) => HttpResponse::Ok().json(OperationOutcome {
            issue: error_response.issue,
        }),
    }
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    let port: u64 = env::var("PORT")
        .unwrap_or(String::from("4000"))
        .parse()
        .unwrap();

    let db_url = env::var("DB_URL").unwrap_or(String::from("mongodb://localhost:27017"));
    let db = env::var("DB").unwrap_or(String::from("terminology_test"));
    let client = web::Data::new(Mutex::new(
        Client::with_uri_str(db_url.as_str()).await.unwrap(),
    ));

    HttpServer::new(move || {
        App::new()
            .data(AppState {
                mongo: client.clone(),
                db: db.clone(),
            })
            .route("/health", web::get().to(health))
            .route("/ValueSet/{id}/$expand", web::get().to(expand))
    })
    .bind(format!("0.0.0.0:{}", port))?
    .run()
    .await
}

Context

Dockerfile:

FROM rust:1.47-alpine as builder
RUN apk add --no-cache musl-dev protoc openssl-dev
ADD  . /app
WORKDIR /app
ENV PROTOC=/usr/bin/protoc
RUN rustup component add rustfmt
RUN cargo install --locked --path .

FROM alpine:3.12
COPY --from=builder /usr/local/cargo/bin/fhir_terminology_server /app/terminology
EXPOSE 4000
CMD ["/app/terminology"]

<!--- How has this issue affected you? What are you trying to accomplish? --> <!--- Providing context helps us come up with a solution that is most useful in the real world -->

Your Environment

Cargo.toml:

[dependencies]
tonic = "0.3.0"
prost = "0.6.1"
actix-web = "3.1.0"
serde = {version = "1.0", features = ["derive"]}
serde_json = "1.0"
mongodb = "1.1.1"
tokio = {version = "0.3.0", features = ["stream"]}

[build-dependencies]
tonic-build = "0.3.0"

Any ideas what can cause such weird behavior in docker only?

created time in a day

more