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

Bug: Crash after synchronizing with std.json.JSONException@std/json.d(315): JSONValue is not an object #2822

Closed
dploeger opened this issue Sep 18, 2024 · 7 comments · Fixed by #2816 or #2851
Labels
Bug Something isn't working Fixed
Milestone

Comments

@dploeger
Copy link

Describe the bug

After synchronizing the data with --sync, the process crashes with this stack:

  std.json.JSONException@std/json.d(315): JSONValue is not an object
  ----------------
  /usr/lib/ldc/x86_64-redhat-linux-gnu/include/d/std/exception.d:519 pure @safe noreturn std.exception.bailOut!(std.json.JSONException).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x68b1e3]
  ??:? inout pure ref @safe inout(std.json.JSONValue) std.json.JSONValue.opIndex(return scope immutable(char)[]) [0x7fe4485c5a93]
  src/sync.d:6027 [0x4d3cac]
  src/sync.d:4417 [0x4d261c]
  src/sync.d:4161 [0x4d1208]
  src/sync.d:4060 [0x4d0c79]
  /usr/lib/ldc/x86_64-redhat-linux-gnu/include/d/std/parallelism.d-mixin-4114:4156 [0x68e3db]
  ??:? void std.parallelism.TaskPool.executeWorkLoop() [0x7fe4485a378d]
  ??:? thread_entryPoint [0x7fe4482da467]
  ??:? [0x7fe447f936d6]
  ??:? __clone [0x7fe448017413]

Operating System Details

We're using a custom docker image based on the pr2816 branch.

Docker engine 

Docker version 27.2.1, build 9e34c9b

on this host:

Linux dtm-devops-p-build-06 5.15.0-122-generic #132-Ubuntu SMP Thu Aug 29 13:45:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.5 LTS
Release:	22.04
Codename:	jammy

Client Installation Method

From Distribution Package

OneDrive Account Type

Business | Office365

What is your OneDrive Application Version

onedrive v2.5.0

What is your OneDrive Application Configuration

# Running container as user: onedrive
# Base Args: --monitor
# Changing ownership permissions on /onedrive/data and /onedrive/conf to onedrive:onedrive
# Launching 'onedrive' as onedrive via gosu
Reading configuration file: /onedrive/conf/config
Configuration file successfully loaded
Application version                          = onedrive v2.5.0
Compiled with                                = LDC 2100
User Application Config path                 = /onedrive/conf
System Application Config path               = /etc/onedrive
Applicable Application 'config' location     = /onedrive/conf/config
Configuration file found in config location  = true - using 'config' file values to override application defaults
Applicable 'sync_list' location              = /onedrive/conf/sync_list
Applicable 'items.sqlite3' location          = /onedrive/conf/items.sqlite3
Config option 'drive_id'                     =
Config option 'sync_dir'                     = /onedrive/data
Config option 'enable_logging'               = false
Config option 'log_dir'                      = /var/log/onedrive
Config option 'disable_notifications'        = false
Config option 'skip_dir'                     =
Config option 'skip_dir_strict_match'        = false
Config option 'skip_file'                    = ~*|.~*|*.tmp|*.swp|*.partial
Config option 'skip_dotfiles'                = false
Config option 'skip_symlinks'                = false
Config option 'monitor_interval'             = 300
Config option 'monitor_log_frequency'        = 12
Config option 'monitor_fullscan_frequency'   = 12
Config option 'read_only_auth_scope'         = false
Config option 'dry_run'                      = false
Config option 'upload_only'                  = false
Config option 'download_only'                = false
Config option 'local_first'                  = false
Config option 'check_nosync'                 = false
Config option 'check_nomount'                = false
Config option 'resync'                       = false
Config option 'resync_auth'                  = false
Config option 'cleanup_local_files'          = false
Config option 'classify_as_big_delete'       = 1000
Config option 'disable_upload_validation'    = false
Config option 'disable_download_validation'  = false
Config option 'bypass_data_preservation'     = false
Config option 'no_remote_delete'             = false
Config option 'remove_source_files'          = false
Config option 'sync_dir_permissions'         = 700
Config option 'sync_file_permissions'        = 600
Config option 'space_reservation'            = 52428800
Config option 'application_id'               = <redacted>
Config option 'azure_ad_endpoint'            =
Config option 'azure_tenant_id'              =
Config option 'user_agent'                   = ISV|abraunegg|OneDrive Client for Linux/v2.5.0
Config option 'force_http_11'                = false
Config option 'debug_https'                  = false
Config option 'rate_limit'                   = 0
Config option 'operation_timeout'            = 3600
Config option 'dns_timeout'                  = 60
Config option 'connect_timeout'              = 10
Config option 'data_timeout'                 = 60
Config option 'ip_protocol_version'          = 0
Config option 'threads'                      = 8
Compile time option --enable-notifications   = false

Selective sync 'sync_list' configured        = false

Config option 'sync_business_shared_items'   = true
Config option 'Shared Files Directory'       = /onedrive/data/Files Shared With Me

Config option 'webhook_enabled'              = false

What is your 'curl' version

There is no curl command in the container image apparently...

Where is your 'sync_dir' located

Local

What are all your system 'mount points'

overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/5JLF3RFFTJY6X5IMN37WUS5NNJ:/var/lib/docker/overlay2/l/7HTAGFZKEB5LWHIE67R4FEAPSI:/var/lib/docker/overlay2/l/62Q34FAOUU43G6FQKLZDZ747XZ:/var/lib/docker/overlay2/l/XQFOILHEZ4XYFNK72GN4RN3G3S:/var/lib/docker/overlay2/l/FXFGMUASRTB76F3TORUONTTSIU:/var/lib/docker/overlay2/l/EBQLC3ZMYKSMTOP3JETN4UW6WV,upperdir=/var/lib/docker/overlay2/cae42f9677a7fb8fd2fc5538d3799244e85944026795a7f0fb987d89569fef90/diff,workdir=/var/lib/docker/overlay2/cae42f9677a7fb8fd2fc5538d3799244e85944026795a7f0fb987d89569fef90/work)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup type cgroup2 (ro,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k,inode64)
/dev/mapper/ubuntuvg-root on /onedrive/data type ext4 (rw,relatime)
/dev/mapper/ubuntuvg-root on /onedrive/conf type ext4 (rw,relatime)
/dev/mapper/ubuntuvg-root on /etc/resolv.conf type ext4 (rw,relatime)
/dev/mapper/ubuntuvg-root on /etc/hostname type ext4 (rw,relatime)
/dev/mapper/ubuntuvg-root on /etc/hosts type ext4 (rw,relatime)
devpts on /dev/console type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
proc on /proc/bus type proc (ro,nosuid,nodev,noexec,relatime)
proc on /proc/fs type proc (ro,nosuid,nodev,noexec,relatime)
proc on /proc/irq type proc (ro,nosuid,nodev,noexec,relatime)
proc on /proc/sys type proc (ro,nosuid,nodev,noexec,relatime)
proc on /proc/sysrq-trigger type proc (ro,nosuid,nodev,noexec,relatime)
tmpfs on /proc/acpi type tmpfs (ro,relatime,inode64)
tmpfs on /proc/kcore type tmpfs (rw,nosuid,size=65536k,mode=755,inode64)
tmpfs on /proc/keys type tmpfs (rw,nosuid,size=65536k,mode=755,inode64)
tmpfs on /proc/timer_list type tmpfs (rw,nosuid,size=65536k,mode=755,inode64)
tmpfs on /proc/scsi type tmpfs (ro,relatime,inode64)
tmpfs on /sys/firmware type tmpfs (ro,relatime,inode64)
tmpfs on /sys/devices/virtual/powercap type tmpfs (ro,relatime,inode64)

What are all your local file system partition types

NAME   FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
loop0
loop1
loop2
loop3
loop4
loop5
loop6
loop7
loop8
loop9
loop10
loop11
sda
|-sda1
|-sda2
`-sda3
sdb

How do you use 'onedrive'

The onedrive sync folder is used for storing export data from one system and synced to a shared business folder.

Steps to reproduce the behaviour

Run onedrive with --sync --resync --resync-auth parameters

Complete Verbose Log Output

Will generate it if required and send the debug log to the mail adress because of possible sensitive data.

Screenshots

No response

Other Log Information or Details

No response

Additional context

No response

@abraunegg
Copy link
Owner

Thanks - I know where this is being generated from, however a fix will have to wait until tomorrow or Friday AEST.

@dploeger
Copy link
Author

That's fine. Thanks!

@abraunegg abraunegg added this to the v2.5.1 milestone Sep 18, 2024
@abraunegg
Copy link
Owner

Unfortunately I am not going to be able to look at anything today - so looking at these issues will be another ~24 hrs or so - sorry.

@abraunegg
Copy link
Owner

@dploeger
Please use the following instructions to clone this PR:

git clone https://github.com/abraunegg/onedrive.git
cd onedrive
git fetch origin pull/2816/head:pr2816
git checkout pr2816

Augment the above with the instructions here on building your own Docker container:

https://github.com/abraunegg/onedrive/blob/master/docs/docker.md#building-a-custom-docker-image

When you rebuild your Docker container, you should be running client version onedrive v2.5.0-11-g8ea3a8c or greater

@dploeger
Copy link
Author

@abraunegg With these changes, our pipeline was successful today. I'll monitor the next days.

@abraunegg
Copy link
Owner

abraunegg commented Sep 20, 2024

Thanks for the confirmation

abraunegg added a commit that referenced this issue Sep 26, 2024
* Add isValidUTCDateTime function to validate timestamp as received from OneDrive API to ensure it is valid
* Use new function before attempting to call SysTime.fromISOExtString to ensure this call will be successful
* If there is no timestamp in the JSON, set it to the system time
* Add assertion when building an item from DB data
* Add new function (isValidUTF8) to check UTF-8 validity of a string before timestamp regex check
* In a --resync scenario, if the file hash is the same, use the online timestamp as source of truth
* Ensure that the session URL data is a valid JSON response before use
* Ensure a local time in UTC is being used if the JSON data has no date
* Ensure the DB is opened in the most threadsafe manner possible
* Add patch provided by @phlibi to add synchronized() around DB access methods
* Align timestamp creation method with itemdb if element is missing
@abraunegg abraunegg reopened this Sep 26, 2024
@abraunegg abraunegg linked a pull request Sep 26, 2024 that will close this issue
@abraunegg
Copy link
Owner

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Repository owner locked as resolved and limited conversation to collaborators Oct 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working Fixed
Projects
None yet
2 participants