Post

Replies

Boosts

Views

Activity

How to increase "receive buffer size"
I am trying to host a Flask API on docker/ Podman (tried on both). It works as expected when directly run on macOS using python3 command. But when I try to dockerize it, it throws an error and some logs like 2024-07-30 03:33:20,661 - INFO - Tunnel Output: 2024-07-30T03:32:58Z INF Starting metrics server on 127.0.0.1:46585/metrics 2024-07-30 03:33:21,669 - INFO - Tunnel Output: 2024/07/30 03:32:58 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 7168 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details. 2024-07-30 03:33:21,671 - INFO - New Cloudflare URL: https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes 2024-07-30 03:33:21,672 - INFO - My API URL: http://127.0.0.1:5000 2024-07-30 03:33:21,672 - INFO - My Cloudflare URL: https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes I tried following but no success (by changing "/etc/sysctl.conf": kern.ipc.maxsockbuf=16777216 net.inet.tcp.win_scale_factor=8 net.inet.tcp.autorcvbufmax=33554432 net.inet.tcp.autosndbufmax=33554432 net.inet.udp.recvspace=8388608 net.inet.udp.maxdgram=8388608 I tried def set_socket_buffers(sock, recv_buf_size, send_buf_size): # Set the receive buffer size sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, recv_buf_size) # Set the send buffer size sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, send_buf_size) # Verify the buffer sizes actual_recv_buf_size = sock.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF) actual_send_buf_size = sock.getsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF) logging.info(f"Requested receive buffer size: {recv_buf_size} bytes") logging.info(f"Actual receive buffer size: {actual_recv_buf_size} bytes") logging.info(f"Requested send buffer size: {send_buf_size} bytes") logging.info(f"Actual send buffer size: {actual_send_buf_size} bytes") if __name__ == "__main__": print("Starting the main process...") # Define the path to the log file log_file_path = "logs.log" # Clear the log file before starting logging clear_log_file(log_file_path) # Configure logging logging.basicConfig( filename=log_file_path, level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s", ) logging.info("Starting the main process...") # Define the desired buffer sizes recv_buf_size = 8388608 # 8 MB send_buf_size = 8388608 # 8 MB # Create a UDP socket udp_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # Set the socket buffers set_socket_buffers(udp_sock, recv_buf_size, send_buf_size) main() On directly running (using python3 command), the values set as expected but when running on Docker logs come out as: 2024-07-30 03:32:50,987 - INFO - Requested receive buffer size: 8388608 bytes 2024-07-30 03:32:50,987 - INFO - Actual receive buffer size: 425984 bytes 2024-07-30 03:32:50,987 - INFO - Requested send buffer size: 8388608 bytes 2024-07-30 03:32:50,987 - INFO - Actual send buffer size: 425984 bytes So, I want to know how to increase UDP Receive buffer size for dockerized applications. Thanks!
1
0
417
Jul ’24
App Group Not working as intended after updating to macOS 15 beta.
I have an app (currently not released on App Store) which runs on both iOS and macOS. The app has widgets for both iOS and macOS which uses user preference (set in app) into account while showing data. Before upgrading to macOS 15 (until Sonoma) widgets were working fine and app was launching correctly, but after upgrading to macOS 15 Sequoia, every time I launch the app it give popup saying '“Kontest” would like to access data from other apps. Keeping app data separate makes it easier to manage your privacy and security.' and also widgets do not get user preferences and throw the same type of error on Console application when using logging. My App group for both iOS and macOS is 'group.com.xxxxxx.yyyyy'. I am calling it as 'UserDefaults(suiteName: Constants.userDefaultsGroupID)!.bool(forKey: "shouldFetchAllEventsFromCalendar")'. Can anyone tell, what am I doing wrong here?
22
8
2.1k
Jun ’24