nextcloud / nextcloud/android

HEAD request from SSO-authorized client app leads to Nextcloud app crash

Open
#12,186 0 comments 0 reactions 0 assignees View on GitHub
bug developer experience feature: authentication integration performance: NPE :no_entry_sign: stable-3.26
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### ⚠️ Before posting ⚠️

- [X] This is a **bug**, not a question or an enhancement.
- [X] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [X] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [X] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).

### Steps to reproduce

The following code which executed in client application leads to Nextcloud app crash when called
```Java
@Override
public boolean checkNewNotifications() throws Exception {
NextcloudRequest request = new NextcloudRequest.Builder().setMethod("HEAD")
.setUrl(Uri.encode("/ocs/v2.php/apps/notifications/api/v2/notifications", "/"))
.build();
Response response = API.performNetworkRequestV2(request);
String lastEtag = Objects.requireNonNull(response.getPlainHeader("ETag")).getValue();
Log.d(TAG, "lastETag=" + lastEtag);
Log.d(TAG, "mETag=" + mETag);
if(!lastEtag.equals(mETag)){
Log.d(TAG, "New notifications found");
mETag = lastEtag;
return true;
}
return false;
}
```
See the code [here](https://github.com/Andrewerr/NextcloudServices/blob/4e72dd7989d9f52dbe8749f366966480862550e9/app/src/main/java/com/polar/nextcloudservices/API/NextcloudSSOAPI.java#L172)
Note that changing request method to `GET` fixes error, though makes such requests energy-inefficient

### Expected behaviour

The HEAD request should properly work without throwing exception and/or crashing Nextcloud app

### Actual behaviour

The Nextcloud app crashes showing the following report

```
Exception in thread "ParcelFileDescriptor Transfer Thread" java.lang.NullPointerException
at java.io.SequenceInputStream.nextStream(SequenceInputStream.java:112)
at java.io.SequenceInputStream.read(SequenceInputStream.java:211)
at java.io.InputStream.read(InputStream.java:205)
at com.nextcloud.android.sso.aidl.ParcelFileDescriptorUtil$TransferThread.run(ParcelFileDescriptorUtil.java:76)
```

App information

ID: `com.nextcloud.client`

Version: `30260090`

Build flavor: `generic`

Device information

Brand: `OnePlus`

Device: `OnePlus7TProNR`

Model: `HD1925`

Id: `TQ3A.230901.001`

Product: `OnePlus7TProNR`

Firmware

SDK: `33`

Release: `13`

Incremental: `PolarMod-1.3-r1-hotdogg-20231016_145036-user`

### Android version

13

### Device brand and model

OnePlus 7T Pro 5G(hotdogg)

### Stock or custom OS?

Custom

### Nextcloud android app version

3.26.0(F-Droid)

### Nextcloud server version

27.1.3

### Using a reverse proxy?

Yes

### Android logs

[crash.log](https://github.com/nextcloud/android/files/13401128/crash.log)

### Server error logs

```bash
[Sat Nov 18 19:28:20.147789 2023] [core:error] [pid 27955:tid 140288571983552] [client 100.64.22.27:53598] AH00082: an unknown filter was not added: Deflate
[Sat Nov 18 19:28:20.367436 2023] [mpm_worker:error] [pid 25117:tid 140289272453184] AH00288: scoreboard is full, not at MaxRequestWorkers
[Sat Nov 18 19:28:20.445802 2023] [core:error] [pid 27675:tid 140287053657792] [client 100.64.22.27:53610] AH00082: an unknown filter was not added: Deflate
[Sat Nov 18 19:28:20.694604 2023] [core:error] [pid 27990:tid 140288991422144] [client 100.64.22.27:53612] AH00082: an unknown filter was not added: Deflate
[Sat Nov 18 19:28:21.068449 2023] [core:error] [pid 28025:tid 140289108854464] [client 100.64.22.27:53614] AH00082: an unknown filter was not added: Deflate
[Sat Nov 18 19:28:21.368670 2023] [mpm_worker:error] [pid 25117:tid 140289272453184] AH00288: scoreboard is full, not at MaxRequestWorkers
[Sat Nov 18 19:28:21.380971 2023] [core:error] [pid 28026:tid 140287993181888] [client 100.64.22.27:53618] AH00082: an unknown filter was not added: Deflate
[Sat Nov 18 19:28:21.814248 2023] [core:error] [pid 28094:tid 140287649244864] [client 100.64.22.27:53628] AH00082: an unknown filter was not added: Deflate
[Sat Nov 18 19:28:22.369872 2023] [mpm_worker:error] [pid 25117:tid 140289272453184] AH00288: scoreboard is full, not at MaxRequestWorkers
[Sat Nov 18 19:28:22.550135 2023] [core:error] [pid 28095:tid 140288253224640] [client 100.64.22.27:58026] AH00082: an unknown filter was not added: Deflate
[Sat Nov 18 19:28:23.371402 2023] [mpm_worker:error] [pid 25117:tid 140289272453184] AH00288: scoreboard is full, not at MaxRequestWorkers
[Sat Nov 18 19:28:24.372663 2023] [mpm_worker:error] [pid 25117:tid 140289272453184] AH00288: scoreboard is full, not at MaxRequestWorkers
[Sat Nov 18 19:28:25.373901 2023] [mpm_worker:error] [pid 25117:tid 140289272453184] AH00288: scoreboard is full, not at MaxRequestWorkers
[Sat Nov 18 19:28:26.379545 2023] [mpm_worker:error] [pid 25117:tid 140289272453184] AH00288: scoreboard is full, not at MaxRequestWorkers
[Sat Nov 18 19:28:27.380740 2023] [mpm_worker:error] [pid 25117:tid 140289272453184] AH00288: scoreboard is full, not at MaxRequestWorkers
[Sat Nov 18 19:28:28.381905 2023] [mpm_worker:error] [pid 25117:tid 140289272453184] AH00288: scoreboard is full, not at MaxRequestWorkers
[Sat Nov 18 19:28:28.855174 2023] [core:error] [pid 27710:tid 140288949458624] [client 100.64.22.1:60208] AH00082: an unknown filter was not added: Deflate
[Sat Nov 18 19:28:29.383183 2023] [mpm_worker:error] [pid 25117:tid 140289272453184] AH00288: scoreboard is full, not at MaxRequestWorkers
[Sat Nov 18 19:28:29.866286 2023] [core:error] [pid 28096:tid 140287540172480] [client 100.64.22.1:42815] AH00082: an unknown filter was not added: Deflate
```

### Additional information

* The ROM in use is [PolarMod](https://github.com/PolarMod) which is slightly customized LinageOS(hardened malloc, minor UI customizations and bootloader lock support)
* Logs are partially provided due to private information stored in them
* `HEAD` requests seem to work without SSO
* Server logs are in EET time, device logs are in CEST time
* The [issue](https://github.com/Andrewerr/NextcloudServices/issues/68) with more detailed logs from side of application is opened in repository of my application

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.