Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow internet connection, parallel uploads time out, entire home network unusable #438

Closed
dkaoster opened this issue Aug 18, 2021 · 20 comments · Fixed by #816
Closed

Slow internet connection, parallel uploads time out, entire home network unusable #438

dkaoster opened this issue Aug 18, 2021 · 20 comments · Fixed by #816

Comments

@dkaoster
Copy link

Describe the bug
My internet connection is fairly slow, (about 2mbps up) and as a result, Maestral seems to get stuck in a loop and eat up bandwidth to the point of making the entire internet connection unusable when trying to upload a bunch of files at the same time. After monitoring with maestral activity, I noticed that it tries to upload over 30 files in parallel, all of them time out and do not complete, and then it restarts the whole process over again of uploading over 30 files in parallel, getting stuck in this never ending cycle.

Screen Shot 2021-08-17 at 11 38 23 PM

I've searched the docs to maybe find a way to configure maximum parallel uploads, but it doesn't seem that there is such an option. My current workaround is to move all the files out of the folder, and drop them in one by one so that maestral doesn't try to upload them all in parallel and crash my internet connection.

To Reproduce
Drag a folder of over 100 images into maestral on a slow internet connection.

Expected behaviour
Hopefully would be able to configure max parallel uploads to prevent this kind of problem.

System:

  • Maestral version: 1.4.6
  • Python version: 3.9.6
  • OS: MacOS Big Sur
@dkaoster dkaoster added the bug Something isn't working label Aug 18, 2021
@samschott samschott added daemon feature request and removed bug Something isn't working labels Aug 19, 2021
@samschott
Copy link
Owner

Thanks for the report! The queue of "uploading" files contains all of the registered file changes but they won't actually all be uploaded in parallel. At present, the number of parallel uploads is determined by the number of CPU cores times 3 and maxes out at 32, so 12 upload threads for a quad-core CPU. In addition, uploading is throttled if CPU usage because too high (the threshold can be changed in the config file). This is because content hashing to determine sync conflicts is quite CPU intensive.

I agree, it would be would be good to also limit bandwidth usage. Instead of directly limiting the number of parallel uploads or downloads I'd however rather expose a config value for the max bandwidth usage, similarly to what is available for CPU usage at the moment.

For the time being, you should be able to exploit the CPU usage setting for your purposes by reducing the max CPU usage from 20% per core to a lower value, e.g., 2%. The documentation at https://maestral.app/docs/configfile explains how this can be done. This will result in uploads being automatically throttled. Downloads will continue as is since we don't currently perform content hashing during downloads, however most internet providers allow for larger download bandwidth compared to uploads.

@dkaoster
Copy link
Author

@samschott That makes sense! Thank you for the explanation and the work you're doing on Maestral. If this is something you feel like I could help out with, I'm happy to try to dive into the code and contribute a PR.

@samschott
Copy link
Owner

samschott commented Aug 21, 2021

If you are happy to look into this, a PR will be very welcome!

Bandwidth limits should apply across all parallel data transfers since a single upload or download can still max out the entire available bandwidth. We therefore ideally want to track total bandwidth usage over a sliding window (e.g., a few seconds) and rate limit chunked uploads or downloads accordingly.

The actual uploads and downloads are handled by the client module in client.DropboxClient.upload() and client.DropboxClient.download().

Downloads: We currently iterate over the response content in chunks of 8192 bytes. Rate limiting could easily plug in here and throttle / pause between iterations.

Uploads: Files that are larger than 5 MB are uploaded in chunks of 5 MB with each chunk being uploaded in a separate post request. That chunk size may already be too large for an effective bandwidth limit. However, I'm not sure if uploading smaller chunks with a larger number of requests is the best way to go here. Maybe we need a custom requests.Session object that implements rate limiting for the upload at a lower level. Any ideas you have a welcome! The relevant Dropbox API endpoint is files/upload_session/append which corresponds to files_upload_session_append_v2 in the Python SDK.

As you see, it won't be an easy problem. I'm happy to help, especially with questions about the current code base.

@lgarron
Copy link

lgarron commented Jan 20, 2023

I've been debugging network connectivity issues for several months, and concluded that Maestral is the culprit:

  • With Maestral stopped, I see consistent 12-15ms ping to 1.1.1.1 with essentially no packet loss.
  • With Maestral started and several files uploading, I see 60ms ping with extremely high packet loss.

In other words, Maestral makes the network completely unusable on my computer (in addition to crowding out other devices on the network).

All of this is with max_cpu_percent = 1.0, so the workaround from this comment is unfortunately useless to me. 😔
I'd love to dig into the code and help out, but unfortunately I'm already in the middle of too many bugs I'm fixing for other projects that I use. 😕

I'd love to see some sort of stop-gap solution within Maestral to prevent the extreme network hogging behaviour, even if it isn't perfect.

EDIT: I'm having some luck with max_cpu_percent = 0.1 but I'm still worried that the workaround will not last. Plus I still have to tune this per machine, whereas a bandwidth limit is much easier to reason about.

@samschott
Copy link
Owner

Indeed, max_cpu_percent really only limits CPU usage. For Maestral, this mostly means calculating content hashes of files before upload. On a machine with a high-powered CPU but a slow internet connection, you will be out of luck. What is more, Maestral caches computed hashes for efficiency, so any retried transfers won't be throttled at all.

What is needed is indeed explicit limiting of bandwidth usage.

Throttling downloads will be easy since the Dropbox SDK supports steaming downloads. Throttling uploads requires a bit more work to do well, because the Python Dropbox SDK does not support streaming uploads due to potential difficulty with retrying failures on non-rewindable streams.

This means that the easiest way limit upload speed is to manually pause between individual post requests, each transferring around 4 MB in Maestral's case (this is chosen both for performance and to limit the total number of API calls required for an upload). As a result, upload throttling will likely be spiky with a target bandwidth only achieved on average. There are alternatives, but they require bypassing the Dropbox SDK and therefore will be a lot more work.

Are you seeing the most issues with uploads or downloads?

@samschott
Copy link
Owner

Filed a feature request with the Dropbox SDK to allow chunked or streaming uploads: dropbox/dropbox-sdk-python#459. If they agree drop the current limitation, this should greatly simplify implementing bandwidth usage limits.

@lgarron
Copy link

lgarron commented Feb 3, 2023

Throttling downloads will be easy since the Dropbox SDK supports steaming downloads.

Although I normally have more trouble with upload speeds, I'm currently setting up a new computer and would really be grateful for download bandwidth throttling in Maestral at the moment. I've spent a long time on workarounds, and I've concluded that I can't really do this properly without support in Maestral itself.

@lgarron
Copy link

lgarron commented Feb 4, 2023

😍😍😍

I've noticed you've released v1.6.6.dev1 but the publish workflow only works for versions containing two dots. Could I ask if there's a build I can test, or an easy way to build locally?

@lgarron
Copy link

lgarron commented Feb 4, 2023

Could I ask if there's a build I can test, or an easy way to build locally?

Okay, I was able to sort of copy:

https://github.com/samschott/maestral/blob/main/.github/workflows/publish.yml#L18-L26

lgarron@pythagoras ~/C/g/g/s/m/d/m/src (main)> python3 -m maestralbuild bandwidth-limit up 0.75
✓ Upload bandwidth limit set to 0.75 MB/sec.
lgarron@pythagoras ~/C/g/g/s/m/d/m/src (main)> python3 -m maestralbuild bandwidth-limit down 3
✓ Download bandwidth limit set to 3.0 MB/sec.
lgarron@pythagoras ~/C/g/g/s/m/d/m/src (main)> python3 -m maestralbuild stop
Stopping Maestral...        [KILLED]
lgarron@pythagoras ~/C/g/g/s/m/d/m/src (main)> python3 -m maestralbuild start
Starting Maestral.../Users/lgarron/Library/Python/3.9/lib/python/site-packages/dropbox/session.py:1: UserWarning: Module maestral was already imported from /Users/lgarron/Library/Python/3.9/lib/python/site-packages/maestral/__init__.py, but /Users/lgarron/Code/git/github.com/samschott/maestral/dist/maestral-1.6.6.dev1/src is being added to sys.path
  import pkg_resources
Starting Maestral...        [OK]

But it seems I can't actually run it directly:

> python3 -m maestralbuild activity
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/lgarron/Code/git/github.com/samschott/maestral/dist/maestral-1.6.6.dev1/src/maestralbuild/__main__.py", line 5, in <module>
    main(prog_name="maestral")
  File "/Users/lgarron/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/lgarron/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/lgarron/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/lgarron/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/lgarron/Library/Python/3.9/lib/python/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/lgarron/Code/git/github.com/samschott/maestral/dist/maestral-1.6.6.dev1/src/maestralbuild/cli/common.py", line 109, in wrapper
    return ctx.invoke(f, proxy, *args, **kwargs)
  File "/Users/lgarron/Library/Python/3.9/lib/python/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/lgarron/Code/git/github.com/samschott/maestral/dist/maestral-1.6.6.dev1/src/maestralbuild/cli/common.py", line 34, in wrapper
    return func(*args, **kwargs)
  File "/Users/lgarron/Code/git/github.com/samschott/maestral/dist/maestral-1.6.6.dev1/src/maestralbuild/cli/cli_info.py", line 136, in activity
    info = f"{arrow[event.direction]} {event.change_type.name}"
KeyError: <SyncDirection.Down: 'down'>

Then I tried placing the built Python code into the existing published app, but macOS won't launch that app (presumably due to the app signature).

Edit: Wait, that last Franken-app hack might have worked! There's nothing in the menu bar, but maestral activity is showing the files I expect, Activity Monitor is showing that the download is staying close to 3MB/s, and — most importantly — all the bandwidth congestion is gone! 😱🥰

This is probably a crazy way to run the app, but it will make a big difference for me over the next few days. Thanks so much, @samschott!

@samschott
Copy link
Owner

Wait, that last Franken-app hack might have worked!

Oh my, that should not have worked. Out of curiosity, how did you get it run? Just by double clicking the app or through some other black magic? As you note, modifying the files should invalidate the code signature and result in macOS refusing to launch the app.

In any case, I'm glad the bandwidth limit is working well for :)

You can also download a pre-release version from https://nightly.link/samschott/maestral-cocoa/actions/artifacts/541569343.zip.

@lgarron
Copy link

lgarron commented Feb 4, 2023

Oh my, that should not have worked. Out of curiosity, how did you get it run? Just by double clicking the app or through some other black magic? As you note, modifying the files should invalidate the code signature and result in macOS refusing to launch the app.

Yeah, I'm kind of shocked as well!
I know that macOS sometimes lets you run "untrusted" stuff by right-clicking and selecting "Open" in Finder, so I tried that. It looked like it didn't work, but somehow Maestral has successfully been running this way for over half a day.

You can also download a pre-release version from https://nightly.link/samschott/maestral-cocoa/actions/artifacts/541569343.zip.

Thanks! This one works just as well, and has the benefit of having a working menu item. :-D

@lgarron
Copy link

lgarron commented Feb 7, 2023

This may be unrelated, but since trying out the new pre-release, my brand-new M2 Mac Mini is crashing mysteriously about once a day.

/Library/Logs/DiagnosticReports/Maestral_2023-02-06-234238_Pythagoras.wakeups_resource.diag contains this, which I have no idea if is related:

Wakeups:          45001 wakeups over the last 37 seconds (1232 wakeups per second average), exceeding limit of 150 wakeups per second over 300 seconds

Also, Maestral seems to be running into dozens of sync errors while downloading files around 1GB-10GB in size.

I'm not really complaining — I can keep running Maestral until it has download all my backups and stabilizes. Just thought I'd report what I'm seeting.

@samschott
Copy link
Owner

@lgarron, what kind of sync errors are you seeing?

The large number of wake-ups may be related to throttling and may indeed crash the app (but should not crash the entire OS!). Throttling is implemented by pausing download threads for short amounts of time between each 2 kB downloaded. The duration is determined by the download rate limit, while the number of parallel download threads is currently set to 4 * CPU_CORE_COUNT and up to max of 64 threads. The initial reasoning was that CPU usage due to parallel content hashing would be the limiting factor for thread count. Parallel data transfers now can also be problematic, given that we more regularly pause and wake up threads.

The combination of short sleep times and a large number of threads could indeed cause > 150 wakeups per second. Out of interest, how many CPU cores does your shiny new M2 Mac Mini have?

(Very short sleep times occur when the bandwidth limit is set close the actual speed of your network connection. Maestral then does not need to sleep for long to stay below the limit, given the time spent for actual transfer of each 2 kB chunk.)

The solution will likely be to (1) set an upper bound for the thread count below 64 and (2) not sleep for exceedingly short periods of time.

@lgarron
Copy link

lgarron commented Feb 7, 2023

maestral activity is showing:

Status: Syncing ↓ /selective sync/2021-06-14 | archived/files/cubingusa nationals 2018/c0002.mp4, Sync
errors: 35
↓ Added C0002.MP4   ━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 38.4% • 3.7/9.7 GB

After restarting several times, the number of errors has gone down from 42 to 35, so the issue doesn't seem to be deterministic per file.

Other sync failures are for similar video files that are also several GB each:

Screenshot 2023-02-07 at 13 36 31

(Very short sleep times occur when the bandwidth limit is set close the actual speed of your network connection. Maestral then does not need to sleep for long to stay below the limit, given the time spent for actual transfer of each 2 kB chunk.)

I have ≈50Mbps down and recently been trying 4MB/s (== 32Mbps) for the Maestral download limit. I'm gonna try going to 2MB/s to see if that's any better.

Out of interest, how many CPU cores does your shiny new M2 Mac Mini have?

Chip: Apple M2
Total Number of Cores: 8 (4 performance and 4 efficiency)
Memory: 8 GB

@samschott
Copy link
Owner

Darn. Where you seeing similar corruption errors as well with the stable version of Maestral? The throttling logic, especially for downloads, should cause any data corruption by itself.

The wakeup problem is almost definitely caused by throttling, I did not even know that the macOS kernel had such limits. You live and learn :)

@samschott
Copy link
Owner

Could you also post the full diagnostic report from which you cited? I suspect that it may not be a crash report but contain a line such as Action taken: none which indicates that it is informational only.

@lgarron
Copy link

lgarron commented Feb 10, 2023

/Library/Logs/DiagnosticReports/Maestral_2023-02-06-234238_Pythagoras.wakeups_resource.diag

Date/Time:        2023-02-06 23:42:01.013 -0800
End time:         2023-02-06 23:42:37.549 -0800
OS Version:       macOS 13.2 (Build 22D49)
Architecture:     arm64e
Report Version:   40
Incident Identifier: C3BC2A63-288A-4CF5-9A4B-081A51F02571

Data Source: Microstackshots
Shared Cache: 3366B98C-6B8A-3546-8233-DC167320439F slid base address 0x18c388000, slide 0xc388000

Command: Maestral
Path: /Applications/Maestral.app/Contents/MacOS/Maestral
Identifier: com.samschott.maestral
Version: 1.7.0.dev0 (74)
Team ID: G34LNR8C4Y
Is First Party: No
Resource Coalition ID: 1336
Architecture: arm64
Parent: UNKNOWN [1262]
PID: 1264

Event: wakeups
Action taken: none
Wakeups: 45001 wakeups over the last 37 seconds (1232 wakeups per second average), exceeding limit of 150 wakeups per second over 300 seconds
Wakeups limit: 45000
Limit duration: 300s
Wakeups caused: 45001
Wakeups duration: 37s
Duration: 36.54s
Duration Sampled: 0.00s
Steps: 1

Hardware model: Mac14,3
Active cpus: 8
HW page size: 16384
VM page size: 16384

Fan speed: 1698 rpm
Advisory levels: Battery -> 2, User -> 2, ThermalPressure -> 0, Combined -> 2
Free disk space: 107.65 GB/228.27 GB, low space threshold 3072 MB
Vnodes Available: 52.87% (64380/121778)

Preferred User Language: en-US
Country Code: US
OS Cryptex File Extents: 260

Heaviest stack for the target process:
1 thread_start + 8 (libsystem_pthread.dylib + 7724) [0x18c750e2c]
1 _pthread_start + 148 (libsystem_pthread.dylib + 28780) [0x18c75606c]
1 pythread_wrapper + 28 (Maestral + 1691984) [0x1007c1150]
1 thread_run + 80 (Maestral + 2077508) [0x10081f344]
1 method_vectorcall + 308 (Maestral + 328664) [0x1006743d8]
1 _PyEval_Vector + 200 (Maestral + 1267080) [0x100759588]
1 _PyEval_EvalFrameDefault + 41744 (Maestral + 1308984) [0x100763938]
1 method_vectorcall + 444 (Maestral + 328800) [0x100674460]
1 _PyEval_Vector + 200 (Maestral + 1267080) [0x100759588]
1 _PyEval_EvalFrameDefault + 41744 (Maestral + 1308984) [0x100763938]
1 _PyVectorcall_Call + 116 (Maestral + 318556) [0x100671c5c]
1 _PyEval_Vector + 200 (Maestral + 1267080) [0x100759588]
1 _PyEval_EvalFrameDefault + 31404 (Maestral + 1298644) [0x1007610d4]
1 gen_iternext + 36 (Maestral + 417040) [0x100689d10]
1 gen_send_ex2 + 612 (Maestral + 422108) [0x10068b0dc]
1 _PyEval_EvalFrameDefault + 31404 (Maestral + 1298644) [0x1007610d4]
1 gen_iternext + 36 (Maestral + 417040) [0x100689d10]
1 gen_send_ex2 + 612 (Maestral + 422108) [0x10068b0dc]
1 _PyEval_EvalFrameDefault + 10028 (Maestral + 1277268) [0x10075bd54]
1 gen_send_ex2 + 612 (Maestral + 422108) [0x10068b0dc]
1 _PyEval_EvalFrameDefault + 41128 (Maestral + 1308368) [0x1007636d0]
1 _io__Buffered_read + 2064 (Maestral + 1933924) [0x1007fc264]
1 _bufferedreader_raw_read + 144 (Maestral + 1929496) [0x1007fb118]
1 PyObject_VectorcallMethod + 144 (Maestral + 323804) [0x1006730dc]
1 _PyEval_Vector + 200 (Maestral + 1267080) [0x100759588]
1 _PyEval_EvalFrameDefault + 34520 (Maestral + 1301760) [0x100761d00]
1 PyObject_Vectorcall + 80 (Maestral + 318852) [0x100671d84]
1 method_vectorcall_VARARGS + 140 (Maestral + 365324) [0x10067d30c]
1 _ssl__SSLSocket_read + 840 (_ssl.cpython-311-darwin.so + 43848) [0x1039b6b48]
1 SSL_read_ex + 12 (_ssl.cpython-311-darwin.so + 128332) [0x1039cb54c]
1 ssl3_read_internal + 172 (_ssl.cpython-311-darwin.so + 75436) [0x1039be6ac]
1 ssl3_read_bytes + 436 (_ssl.cpython-311-darwin.so + 226832) [0x1039e3610]
1 ssl3_get_record + 768 (_ssl.cpython-311-darwin.so + 231824) [0x1039e4990]
1 ssl3_read_n + 496 (_ssl.cpython-311-darwin.so + 220676) [0x1039e1e04]
1 BIO_read + 28 (_ssl.cpython-311-darwin.so + 495012) [0x103a24da4]
1 bio_read_intern + 292 (_ssl.cpython-311-darwin.so + 495336) [0x103a24ee8]
1 bread_conv + 40 (_ssl.cpython-311-darwin.so + 501740) [0x103a267ec]
1 read + 8 (libsystem_kernel.dylib + 7180) [0x18c716c0c]

Powerstats for: Maestral [1264]
UUID: 40E19BD1-2CD7-3408-842E-42E168B5AEF4
Path: /Applications/Maestral.app/Contents/MacOS/Maestral
Identifier: com.samschott.maestral
Version: 1.7.0.dev0 (74)
Team ID: G34LNR8C4Y
Is First Party: No
Resource Coalition ID: 1336
Architecture: arm64
Parent: UNKNOWN [1262]
UID: 501
Footprint: 61.70 MB
Start time: 2023-02-06 23:42:32.295 -0800
End time: 2023-02-06 23:42:32.295 -0800
Num samples: 1 (100%)
Primary state: 1 samples Non-Frontmost App, Non-Suppressed, User mode, Effective Thread QoS Default, Requested Thread QoS Default, Override Thread QoS Unspecified
User Activity: 0 samples Idle, 1 samples Active
Power Source: 0 samples on Battery, 1 samples on AC
1 thread_start + 8 (libsystem_pthread.dylib + 7724) [0x18c750e2c]
1 _pthread_start + 148 (libsystem_pthread.dylib + 28780) [0x18c75606c]
1 pythread_wrapper + 28 (Maestral + 1691984) [0x1007c1150]
1 thread_run + 80 (Maestral + 2077508) [0x10081f344]
1 method_vectorcall + 308 (Maestral + 328664) [0x1006743d8]
1 _PyEval_Vector + 200 (Maestral + 1267080) [0x100759588]
1 _PyEval_EvalFrameDefault + 41744 (Maestral + 1308984) [0x100763938]
1 method_vectorcall + 444 (Maestral + 328800) [0x100674460]
1 _PyEval_Vector + 200 (Maestral + 1267080) [0x100759588]
1 _PyEval_EvalFrameDefault + 41744 (Maestral + 1308984) [0x100763938]
1 _PyVectorcall_Call + 116 (Maestral + 318556) [0x100671c5c]
1 _PyEval_Vector + 200 (Maestral + 1267080) [0x100759588]
1 _PyEval_EvalFrameDefault + 31404 (Maestral + 1298644) [0x1007610d4]
1 gen_iternext + 36 (Maestral + 417040) [0x100689d10]
1 gen_send_ex2 + 612 (Maestral + 422108) [0x10068b0dc]
1 _PyEval_EvalFrameDefault + 31404 (Maestral + 1298644) [0x1007610d4]
1 gen_iternext + 36 (Maestral + 417040) [0x100689d10]
1 gen_send_ex2 + 612 (Maestral + 422108) [0x10068b0dc]
1 _PyEval_EvalFrameDefault + 10028 (Maestral + 1277268) [0x10075bd54]
1 gen_send_ex2 + 612 (Maestral + 422108) [0x10068b0dc]
1 _PyEval_EvalFrameDefault + 41128 (Maestral + 1308368) [0x1007636d0]
1 _io__Buffered_read + 2064 (Maestral + 1933924) [0x1007fc264]
1 _bufferedreader_raw_read + 144 (Maestral + 1929496) [0x1007fb118]
1 PyObject_VectorcallMethod + 144 (Maestral + 323804) [0x1006730dc]
1 _PyEval_Vector + 200 (Maestral + 1267080) [0x100759588]
1 _PyEval_EvalFrameDefault + 34520 (Maestral + 1301760) [0x100761d00]
1 PyObject_Vectorcall + 80 (Maestral + 318852) [0x100671d84]
1 method_vectorcall_VARARGS + 140 (Maestral + 365324) [0x10067d30c]
1 _ssl__SSLSocket_read + 840 (_ssl.cpython-311-darwin.so + 43848) [0x1039b6b48]
1 SSL_read_ex + 12 (_ssl.cpython-311-darwin.so + 128332) [0x1039cb54c]
1 ssl3_read_internal + 172 (_ssl.cpython-311-darwin.so + 75436) [0x1039be6ac]
1 ssl3_read_bytes + 436 (_ssl.cpython-311-darwin.so + 226832) [0x1039e3610]
1 ssl3_get_record + 768 (_ssl.cpython-311-darwin.so + 231824) [0x1039e4990]
1 ssl3_read_n + 496 (_ssl.cpython-311-darwin.so + 220676) [0x1039e1e04]
1 BIO_read + 28 (_ssl.cpython-311-darwin.so + 495012) [0x103a24da4]
1 bio_read_intern + 292 (_ssl.cpython-311-darwin.so + 495336) [0x103a24ee8]
1 bread_conv + 40 (_ssl.cpython-311-darwin.so + 501740) [0x103a267ec]
1 read + 8 (libsystem_kernel.dylib + 7180) [0x18c716c0c]

Binary Images:
0x100624000 - 0x100a57fff com.samschott.maestral 1.7.0.dev0 (74) <40E19BD1-2CD7-3408-842E-42E168B5AEF4> /Applications/Maestral.app/Contents/MacOS/Maestral
0x1039ac000 - 0x103ca3fff _ssl.cpython-311-darwin.so (0) <38CCFB2C-11AE-3AD3-A546-D0B0CDC2FC9F> /Applications/Maestral.app/Contents/Resources/support/python-stdlib/lib-dynload/_ssl.cpython-311-darwin.so
0x18c715000 - 0x18c74efeb libsystem_kernel.dylib (8792.81.2) <6B682E21-FD96-3A5A-8260-FCE367258252> /usr/lib/system/libsystem_kernel.dylib
0x18c74f000 - 0x18c75bffb libsystem_pthread.dylib (514) <9F3B729A-ED04-3E65-ADAC-D75AD06EBBDC> /usr/lib/system/libsystem_pthread.dylib

but contain a line such as Action taken: none which indicates that it is informational only.

Yeah, I have a few such files, and they seem to contain Action taken: none.

samschott added a commit that referenced this issue Feb 11, 2023
Unblocking on a future may be handled as a thread interrupt and some kernels, in particular Darwin, limit how often those are allowed per second. See #438.
@samschott
Copy link
Owner

Thanks, that is very helpful! Especially the stack traces from Python. My initial suspicion about the regular sleep calls was apparently incorrect, it is the actual socket communication which is causing thread wakeups.

This might be either:

  1. Communication between the GUI and the sync daemon. I'll rate limit the number of status updates sent to the GUI per second.
  2. Transferring data to / from Dropbox servers. This could potentially be solved adapting the chunk size depending on the transfer speed.

@lgarron
Copy link

lgarron commented Feb 13, 2023

Thanks! Is there an easy way for me to updated nightly links to test, by any chance? :-D

@samschott
Copy link
Owner

Unfortunately not at the moment. Nightly builds are not really "nightly" but created only for each new tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants