simple_bridge inets uploading big files

13 views
Skip to first unread message

João Henrique Freitas

unread,
Nov 8, 2022, 8:12:22 PM11/8/22
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hello,

I'm using nitrogen with simple_bridge (inets). My page has an upload button like the demo upload (https://nitrogenproject.com/demos/upload). It works for small files.

With standard inets configuration, I want to upload big files like  > 200Mb.

However, the Erlang VM gets Killed.

Reading inets documentation, I've found this options:

https://www.erlang.org/doc/man/httpd.html
{max_client_body_chunk, integer()}

    Enforces chunking of a HTTP PUT or POST body data to be delivered to the mod_esi callback. Note this is not supported for mod_cgi. Default is no limit e.i the whole body is delivered as one entity, which could be very memory consuming. mod_esi(3).



So, would it be possible to enable the max_client_body_chunk option and also configuring simple_bridge parameters max_post_size and max_file_size to handle big files ? That way inets could better manage its internal resources.

Actually, I tried these parameters plus some modification here https://github.com/joaohf/simple_bridge/pull/new/inets_max_client_body_chunk but I'm getting erros from inets:

-------

(board_ctl@xxx)4> recv reason {error,timeout}=ERROR REPORT==== 9-Nov-2022::00:34:38.286268 ===
Error in simple_bridge:make/2 - exit - normal
[{inets_simple_bridge,recv_from_socket,3,
                      [{file,"/source/ets/erlang/board-upd/_checkouts/simple_bridge/src/inets_bridge_modules/inets_simple_bridge.erl"},
                       {line,122}]},
 {simple_bridge_multipart,read_chunk,1,
                          [{file,"/source/ets/erlang/board-upd/_checkouts/simple_bridge/src/simple_bridge_multipart.erl"},
                           {line,264}]},
 {simple_bridge_multipart,get_next_line,4,
                          [{file,"/tmp/l/source/ets/erlang/board-upd/_checkouts/simple_bridge/src/simple_bridge_multipart.erl"},
                           {line,248}]},
 {simple_bridge_multipart,read_part_value,3,
                          [{file,"/tmp/l/source/ets/erlang/board-upd/_checkouts/simple_bridge/src/simple_bridge_multipart.erl"},
                           {line,189}]},
 {simple_bridge_multipart,parse_multipart,1,
                          [{file,"/tmp/l/source/ets/erlang/board-upd/_checkouts/simple_bridge/src/simple_bridge_multipart.erl"},
                           {line,62}]},
 {simple_bridge,make_nocatch,2,
                [{file,"/source/ets/erlang/board-upd/_checkouts/simple_bridge/src/simple_bridge.erl"},
                 {line,101}]},
 {simple_bridge,inner_make,2,
                [{file,"/ets/erlang/board-upd/_checkouts/simple_bridge/src/simple_bridge.erl"},
                 {line,90}]},
 {inets_simple_bridge_anchor,do,1,
                             [{file,"/tmp/l/source/ets/erlang/board-upd/_checkouts/simple_bridge/src/inets_bridge_modules/inets_simple_bridge_anchor.erl"},
                              {line,5}]}]


** Reason for termination ==                                                                            
** {{badmatch,ok},                                                                                      
    [{httpd_request_handler,handle_internal_chunk,4,                                                                                                                                                              
                            [{file,"httpd_request_handler.erl"},{line,609}]},                                                                                                                                      
     {gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,695}]},      
     {gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,771}]},                                                                                                                                              
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}        
                                                                                                         
=CRASH REPORT==== 9-Nov-2022::00:34:38.349278 ===                                                                                                                                                                  
  crasher:                                                                                                                                                                                                        
    initial call: httpd_request_handler:init/1                                                          
    pid: <0.2887.0>                                                                                                                                                                                                
    registered_name: []                                                                                  
    exception error: no match of right hand side value ok                    
      in function  httpd_request_handler:handle_internal_chunk/4 (httpd_request_handler.erl, line 609)                                                                                                            
      in call from gen_server:try_dispatch/4 (gen_server.erl, line 695)                                                                                                                                            
      in call from gen_server:handle_msg/6 (gen_server.erl, line 771)                                                                                                                                              
    ancestors: [httpd_connection_sup__0_0_0_0__8000,                                                                                                                                                              
                  httpd_instance_sup__0_0_0_0__8000default,httpd_sup,                                    
                  inets_sup,<0.105.0>]                                                                  
    message_queue_len: 0                                                                                
    messages: []                                                                                        
    links: [<0.2825.0>]

--------

For sure there are some code missing on simple_bridge. Would inets configured with max_client_body_chunk be possible ?

PS: I didn't try others simple_bridge backend yet.

Thanks.
Reply all
Reply to author
Forward
0 new messages