cloudflare / cloudflare/cloudflared
🐛 error="Incoming request ended abruptly: context canceled"
- Dominant language
- Go
- Stars
- 15.6k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
When i use flask to create web, sometimes i run web by cloudflare, i get the error. This is full log in cmd:
( is my private ip)
```
C:\Users\annhan\Downloads\webhook>cloudflared.exe tunnel run
2023-07-03T02:47:15Z INF Starting tunnel tunnelID=83343b12-f235-46ff-9b9e-0e857357c51b
2023-07-03T02:47:15Z INF Version 2023.6.1
2023-07-03T02:47:15Z INF GOOS: windows, GOVersion: go1.19, GoArch: amd64
2023-07-03T02:47:15Z INF Settings: map[url:http://127.0.0.1:5000]
2023-07-03T02:47:15Z INF cloudflared will not automatically update on Windows systems.
2023-07-03T02:47:15Z INF Generated Connector ID: 054953f1-0e83-4b9c-9582-0d10cc66cc1a
2023-07-03T02:47:15Z INF Initial protocol quic
2023-07-03T02:47:15Z INF ICMP proxy will use 154.26.134.230 as source for IPv4
2023-07-03T02:47:15Z INF ICMP proxy will use fe80::4fef:1cc7:7e8:8654 in zone Ethernet Instance 0 as source for IPv6
2023-07-03T02:47:15Z INF cloudflared does not support loading the system root certificate pool on Windows. Please use --origin-ca-pool to specify the path to the certificate pool
2023-07-03T02:47:15Z INF Starting metrics server on 127.0.0.1:50351/metrics
2023-07-03T02:47:16Z INF Registered tunnel connection connIndex=0 connection=dd9d26e1-f65f-4af4-a2ed-c8c95b1e30aa event=0 ip=198.41.192.57 location=HKG protocol=quic
2023-07-03T02:47:17Z INF Registered tunnel connection connIndex=1 connection=49dc99bb-f0a2-4f64-8522-5d1b315a246b event=0 ip=198.41.200.113 location=SIN protocol=quic
2023-07-03T02:47:18Z INF Registered tunnel connection connIndex=2 connection=8f587c4a-9402-4339-8778-22ea415ba1cc event=0 ip= location=KUL protocol=quic
2023-07-03T02:47:19Z INF Registered tunnel connection connIndex=3 connection=07dc709f-4ea5-4af6-8b29-e4b33b7b1735 event=0 ip=198.41.200.53 location=SIN protocol=quic
2023-07-03T02:47:48Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcd892f8d4dc8-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:47:48Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=0 dest=https://webhook2603.click//deleteLast?server=1&typetest=1 event=0 ip=198.41.192.57 type=http
2023-07-03T02:47:49Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcd8e188e87e1-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:47:49Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcd8df8d1a12b-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:47:49Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=0 dest=https://webhook2603.click//getLast?server=1&typetest=2 event=0 ip=198.41.192.57 type=http
2023-07-03T02:47:49Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=0 dest=https://webhook2603.click//getLast?server=2&typetest=1 event=0 ip=198.41.192.57 type=http
2023-07-03T02:47:49Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcd8ee8dc44b5-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:47:49Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=0 dest=https://webhook2603.click//deleteLast?server=2&typetest=2 event=0 ip=198.41.192.57 type=http
2023-07-03T02:48:20Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bce51adb14017-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:48:20Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//getLast?server=1&typetest=1 event=0 ip= type=http
2023-07-03T02:48:21Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bce568d314715-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:48:21Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bce568c0140c5-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:48:21Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=3 dest=https://webhook2603.click//deleteLast?server=1&typetest=2 event=0 ip=198.41.200.53 type=http
2023-07-03T02:48:21Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//deleteLast?server=2&typetest=1 event=0 ip= type=http
2023-07-03T02:48:21Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bce575d0a44b9-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:48:21Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//getLast?server=2&typetest=2 event=0 ip= type=http
2023-07-03T02:48:52Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcf19ee6aa069-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:48:52Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=1 dest=https://webhook2603.click//deleteLast?server=1&typetest=1 event=0 ip=198.41.200.113 type=http
2023-07-03T02:48:53Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcf1f0fd43fca-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:48:53Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcf1f0919401e-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:48:53Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//getLast?server=2&typetest=1 event=0 ip= type=http
2023-07-03T02:48:53Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//getLast?server=1&typetest=2 event=0 ip= type=http
2023-07-03T02:48:53Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcf1fbfe63daa-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:48:53Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//deleteLast?server=2&typetest=2 event=0 ip= type=http
2023-07-03T02:49:24Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcfe29d7fab5b-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:49:24Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//getLast?server=1&typetest=1 event=0 ip= type=http
2023-07-03T02:49:25Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcfe7981a3f7d-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:49:25Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//deleteLast?server=2&typetest=1 event=0 ip= type=http
2023-07-03T02:49:25Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcfe79a058856-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:49:25Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bcfe85ac34733-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:49:25Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//deleteLast?server=1&typetest=2 event=0 ip= type=http
2023-07-03T02:49:25Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=3 dest=https://webhook2603.click//getLast?server=2&typetest=2 event=0 ip=198.41.200.53 type=http
2023-07-03T02:49:57Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bd0ab29594d87-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:49:57Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//deleteLast?server=1&typetest=1 event=0 ip= type=http
2023-07-03T02:49:57Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bd0b019653f8d-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:49:57Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bd0b019c74a35-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:49:57Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//getLast?server=2&typetest=1 event=0 ip= type=http
2023-07-03T02:49:57Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=3 dest=https://webhook2603.click//getLast?server=1&typetest=2 event=0 ip=198.41.200.53 type=http
2023-07-03T02:49:58Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bd0b0efe53de1-SIN event=1 originService=http://127.0.0.1:5000
2023-07-03T02:49:58Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click//deleteLast?server=2&typetest=2 event=0 ip= type=http
2023-07-03T02:50:03Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bd18b9ee43070-SEA event=1 originService=http://127.0.0.1:5000
2023-07-03T02:50:03Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click/ event=0 ip= type=http
2023-07-03T02:50:04Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bd18c1c5530a2-SEA event=1 originService=http://127.0.0.1:5000
2023-07-03T02:50:04Z ERR error="Incoming request ended abruptly: context canceled" cfRay=7e0bd18c7885c380-SEA event=1 originService=http://127.0.0.1:5000
2023-07-03T02:50:04Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=2 dest=https://webhook2603.click/ event=0 ip= type=http
2023-07-03T02:50:04Z ERR Request failed error="Incoming request ended abruptly: context canceled" connIndex=1 dest=https://webhook2603.click/ event=0 ip=198.41.200.113 type=http
```
And this is my Python code:
```
from flask import Flask, request
app = Flask(__name__)
app.debug = True
@app.route("/resetall")
def resetall():
for i in range(1, 15):
for z in range(1, 3):
with open(f"data_{z}_{i}.txt", "w", encoding='utf-8') as f:
f.write('')
return ""
@app.route("/", methods=['POST'])
def webhook():
str_req = str(request.data).replace("b'", "").replace("'", "").split("****")
list_a = []
list_b = []
for i in str_req:
if str(i) != '\\n' and str(i) != '' and str(i).find("41*") == -1 and str(i).find("65*") == -1 and str(i).find("05*") == -1 and str(i).find("67*") == -1 and str(i).find("23*") == -1 and str(i).find("42*") == -1:
list_a.append(i)
elif str(i) != '\\n' and str(i) != '':
list_b.append(i)
with open("data_1_1.txt", "a", encoding='utf-8') as f:
for i in list_a:
f.write(i + '\n')
with open("data_1_2.txt", "a", encoding='utf-8') as f:
for i in list_a:
f.write(i + '\n')
if len(list_b) > 0:
with open("data_2_1.txt", "a", encoding='utf-8') as f:
for i in list_b:
f.write(i + '\n')
with open("data_2_2.txt", "a", encoding='utf-8') as f:
for i in list_b:
f.write(i + '\n')
for i in range(3, 15):
with open(f"data_1_{i}.txt", "a", encoding='utf-8') as f:
for i in list_a:
f.write(i + '\n');
for i in list_b:
f.write(i + '\n');
for i in range(3,15):
with open(f"data_2_{i}.txt", "a", encoding='utf-8') as f:
for i in list_a:
if str(i)[0] == "5":
f.write(i + '\n')
for i in list_b:
if str(i)[0] == "5":
f.write(i + '\n')
return ""
@app.route('/getLast')
def getData_1():
sv = request.args.get('server')
numtest = request.args.get('typetest')
s = open(f"data_{sv}_{numtest}.txt", "r", encoding='utf-8').readlines()
if len(s) == 0:
return ""
return s[len(s) - 1]
@app.route('/deleteLast')
def deleteData_1():
sv = request.args.get('server')
numtest = request.args.get('typetest')
file = open(f"data_{sv}_{numtest}.txt", "r", encoding='utf-8')
lines = file.readlines()[:-1]
with open(f"data_{sv}_{numtest}.txt", "w", encoding='utf-8') as f:
for i in lines:
f.write(i)
return ""
@app.route('/pass')
def pass_text():
numtest = request.args.get('typetest')
lines = open(f"data_1_{numtest}.txt", "r", encoding='utf-8').readlines()
if len(lines) == 0:
return ""
with open(f"data_2_{numtest}.txt", "a", encoding='utf-8') as f:
for i in lines:
if i != "\n":
f.write(i)
with open(f"data_1_{numtest}.txt", "w", encoding='utf-8') as f:
f.write('')
return ""
if __name__ == "__main__":
app.run()
```
Can anyone have solution to fix it?
Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.