Commit d4a019e
authored
Stop upload channel with {:shutdown, :closed} on writer error so the LiveView survives (#4320)
A custom UploadWriter returning {:error, _} (from write_chunk/2 or
close/2) currently brings down the whole LiveView, not just the failed
entry. The upload channel replies with the error but stays alive. The JS
client's error/1 then calls leave(), so the channel exits
{:shutdown, :left}, and the parent LiveView's {:DOWN} handler stops on
any non-:closed upload-channel exit ({:channel_upload_exit, _}).
Oversized files already self-close with {:shutdown, :closed} in the same
handle_in/3. Writer errors were the one branch that didn't. Stopping with
{:shutdown, :closed} drops the failed entry (threading the stored cid so
component uploads drop too) and the LiveView survives. The error reply is
still delivered to the client before the channel stops.
A close(:done) failure already closed the writer before this branch runs,
so the branch now skips a second close/2 (as handle_call(:cancel, ...)
already does). Otherwise a writer that is not safe to close twice could
raise and crash the channel with an abnormal exit, killing the LiveView
through the same path this change is meant to fix.1 parent 9e445c8 commit d4a019e
2 files changed
Lines changed: 87 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
105 | 106 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
112 | 117 | | |
113 | | - | |
| 118 | + | |
114 | 119 | | |
115 | 120 | | |
116 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
45 | 66 | | |
46 | 67 | | |
47 | 68 | | |
48 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
49 | 74 | | |
50 | 75 | | |
51 | 76 | | |
| |||
858 | 883 | | |
859 | 884 | | |
860 | 885 | | |
861 | | - | |
| 886 | + | |
862 | 887 | | |
863 | 888 | | |
864 | 889 | | |
865 | | - | |
| 890 | + | |
| 891 | + | |
866 | 892 | | |
867 | 893 | | |
868 | | - | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
869 | 927 | | |
870 | 928 | | |
871 | 929 | | |
872 | 930 | | |
873 | 931 | | |
874 | 932 | | |
875 | | - | |
876 | | - | |
| 933 | + | |
| 934 | + | |
877 | 935 | | |
878 | | - | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
879 | 951 | | |
880 | 952 | | |
881 | 953 | | |
| |||
0 commit comments