Big file upload

71 views
Skip to first unread message

tome...@gmail.com

unread,
Mar 11, 2014, 5:25:50 AM3/11/14
to chica...@googlegroups.com
Hi!

I want to upload 150Mb files with CB.
First problem I encountered is simple_bridge_max_post_size.
It is set to 100Mb and it says:
% Override with -simple_bridge_max_post_size SizeInMB
I am not sure, how do I pass command line arguments to CB.
Should I modify rebar start command? Is there a way to pass variable by setting it in boss.config?

For now, I've edited simple_bridge_multipart.erl
-define (MAX_POST_SIZE, 1000).

Second problem is body_too_large
returned from mochicow_request:stream_body/4
Should I increase some value here too?

 BR,
Tomasz Kowal

chan sisowath

unread,
Mar 11, 2014, 5:43:22 AM3/11/14
to chica...@googlegroups.com
should be configurable from boss.config like any otp app i guess

[
...
{simple_bridge, [
     {simple_bridge_max_post_size, 150}
] },

Jess could confirm or not




--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/6289b9d6-b920-4829-be9d-81f8ad80c3d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

tome...@gmail.com

unread,
Mar 11, 2014, 6:11:37 AM3/11/14
to chica...@googlegroups.com
It seems, that simple bridge is not started as an application.
It is used as a library, which means, that application:get_env will return undefined,
no matter what I put in application config.
That is why it uses internally different function to get this value:
init:get_argument(simple_bridge_max_post_size).
But I don't know how to pass arguments to erlang during CB startup

Niclas Axelsson

unread,
Mar 11, 2014, 6:13:17 AM3/11/14
to chica...@googlegroups.com
Hi,

You can set the variables in boss.config:

[{boss,       [
               {path, "../ChicagoBoss"},
               {vm_args, "-simple_bridge_max_post_size 20000 -simple_bridge_scratch_dir \"/..data\””}

Best regards,
Niclas


tome...@gmail.com

unread,
Mar 11, 2014, 6:59:10 AM3/11/14
to chica...@googlegroups.com
Thanks! It solves my first issue :)
Second problem is this message:

[error] Error in simple_bridge_request:make/2 - exit - {body_too_large,content_length}
[{mochicow_request,stream_body,5,[{file,"src/mochicow_request.erl"},{line,323}]},{mochicow_request,recv_body,2,[{file,"src/mochicow_request.erl"},{line,275}]},{simple_bridge_multipart,parse_multipart,1,[{file,"src/simple_bridge_multipart.erl"},{line,69}]},{simple_bridge_request,make_nocatch,2,[{file,"src/simple_bridge_request.erl"},{line,23}]},{simple_bridge_request,make,2,[{file,"src/simple_bridge_request.erl"},{line,14}]},{boss_web_controller_handle_request,handle_request,3,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,17}]},{mochicow_upgrade,upgrade,4,[{file,"src/mochicow_upgrade.erl"},{line,72}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,529}]}]

In mochiweb_request_bridge.erl
there is a constant defined:
-define(MAX_RECV_BODY,(1024*1024*10)).
and it is used to define MaxBody like this:
141     MaxBody = case application:get_env(mochiweb,max_request_size) of
142         undefined ->
143             ?MAX_RECV_BODY;
144         {ok, Max} when is_integer(Max) ->
145             Max;
146         Other ->
147             error_logger:warning_msg("Mochiweb Simple Bridge Configuration Error!  Unknown value for 'mochiweb' application variable 'max_request_size': ~p. Expected: integer()
148             ?MAX_RECV_BODY
149     end,
mochiweb application is never started, so get_env/2 will always return undefined.
It probably means, that I have no way to configure it :/
I have to change the hardcoded value.

Do you think, that it should also be configured as vm argument?
In that case, I can create pull request.

Jesse Gumm

unread,
Mar 11, 2014, 9:39:30 AM3/11/14
to chica...@googlegroups.com
What I would do, for now, is to add application:load(mochiweb) to
probably boss.erl just before the application:start(boss), which will
then make the mochiweb application vars readable without starting the
mochiweb server itself.

That said, this is one of those examples of warts that's fixed in
SimpleBridge 2.0, because this kind of mixing of configuration methods
is completely error-prone and confusing (a mix of erlang launch flags
and configuration variables is not exactly *consistent*, is it?)

-Jesse
>> ...
> https://groups.google.com/d/msgid/chicagoboss/6bb76923-6a4c-4eb0-847e-b0cefcb8a3d0%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

tome...@gmail.com

unread,
Mar 11, 2014, 11:35:20 AM3/11/14
to chica...@googlegroups.com
application:load/1 is really good idea.
Thanks again!
Looking forward to integrating SimpleBridge 2.0 into CB :)

BR,
Tomasz Kowal

Jesse Gumm

unread,
Mar 11, 2014, 11:37:07 AM3/11/14
to chica...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages