问:
Pipe reader is not getting unblocked
I am using System.IO.Pipelines to read from a web socket and bumped into a problem where PipeReader.ReadAsync is not getting unblocked, with the example code I can clearly see that the full messages are read from the web socket and flushed BUT the reader is not unblocked.

Could someone point what could be wrong with my implementation

```<code>    protected async Task FillTask(CancellationToken cancellationToken = default)
    {
        var writer = _input.Writer;
        try
        {
            IsReceiving = true;

            while (_webSocket.State == WebSocketState.Open && !cancellationToken.IsCancellationRequested)
            {
                //get buffer for writing
                var buffer = writer.GetMemory(1024);

                //get the array segment from the buffer
                MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> segment);

                //write data received from socket into the buffer
                var result = await _webSocket.ReceiveAsync(segment, cancellationToken).ConfigureAwait(false);

                Debug.WriteLine($"Read result {result.MessageType}");
                Debug.WriteLine($"Read {result.Count} from socket");

                //advance reader
                writer.Advance(result.Count);

                //if full message received flush the data to the reader
                if (result.EndOfMessage)
                {
                    writes++;
                    Debug.WriteLine($"Writes {writes}");
                    var flushTask = await writer.FlushAsync(cancellationToken).ConfigureAwait(false);
                    if (flushTask.IsCompleted)
                    {
                        break;
                    }

                }
            }
        }
        catch (Exception ex)
        {
            RaiseExceptionEvent(ex);
        }
        finally
        {
            await writer.CompleteAsync().ConfigureAwait(false);
            IsConnected = false;
            IsReceiving = false;
        }
    }
    protected async Task ReadTask(PipeReader reader, CancellationToken cancellationToken = default)
    {
        //loop and read data from reader as long as its required
        while (true && !cancellationToken.IsCancellationRequested)
        {
            //read from reader
            ReadResult result = await reader.ReadAsync(cancellationToken).ConfigureAwait(false);

            //get reader buffer
            var buffer = result.Buffer;

            //check if any data where read
            if (buffer.Length > 0)
            {
                //rent byte array
                var array = _pool.Rent((int)buffer.Length);
                try
                {
                    //copy the buffer to newly created array
                    result.Buffer.CopyTo(array);

                    //advance reader
                    reader.AdvanceTo(result.Buffer.End,result.Buffer.End);

                    receives++;
                    Debug.WriteLine($"Receives {receives}");

                    //raise event and process the data
                    RaiseDataReceivedEvent(default, array, 0, (int)result.Buffer.Length);

                    Debug.WriteLine($"Receives {receives} - Sends {sends}");

                    BytesReceived += (ulong)buffer.Length;
                }
                catch
                {
                    throw;
                }
                finally
                {
                    //return the array to the pool
                    _pool.Return(array);
                }
            }

            // stop reader once there is no more data to read
            if (result.IsCompleted)
                break;
        }

        await reader.CompleteAsync().ConfigureAwait(false);
    }
</code>```

Edit

Setting the PipeOptions to PipeScheduler.Inline for reader resolves the problem, would be interesting to know why.

Title: Pipe reader is not getting unblocked

Body:
I am using System.IO.Pipelines to read from a web socket and bumped into a problem where PipeReader.ReadAsync is not getting unblocked, with the example code I can clearly see that the full messages are read from the web socket and flushed BUT the reader is not unblocked.

Could someone point what could be wrong with my implementation

    protected async Task FillTask(CancellationToken cancellationToken = default)
    {
        var writer = _input.Writer;
        try
        {
            IsReceiving = true;

            while (_webSocket.State == WebSocketState.Open && !cancellationToken.IsCancellationRequested)
            {
                //get buffer for writing
                var buffer = writer.GetMemory(1024);

                //get the array segment from the buffer
                MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> segment);

                //write data received from socket into the buffer
                var result = await _webSocket.ReceiveAsync(segment, cancellationToken).ConfigureAwait(false);

                Debug.WriteLine($"Read result {result.MessageType}");
                Debug.WriteLine($"Read {result.Count} from socket");

                //advance reader
                writer.Advance(result.Count);

                //if full message received flush the data to the reader
                if (result.EndOfMessage)
                {
                    writes++;
                    Debug.WriteLine($"Writes {writes}");
                    var flushTask = await writer.FlushAsync(cancellationToken).ConfigureAwait(false);
                    if (flushTask.IsCompleted)
                    {
                        break;
                    }

                }
            }
        }
        catch (Exception ex)
        {
            RaiseExceptionEvent(ex);
        }
        finally
        {
            await writer.CompleteAsync().ConfigureAwait(false);
            IsConnected = false;
            IsReceiving = false;
        }
    }
    protected async Task ReadTask(PipeReader reader, CancellationToken cancellationToken = default)
    {
        //loop and read data from reader as long as its required
        while (true && !cancellationToken.IsCancellationRequested)
        {
            //read from reader
            ReadResult result = await reader.ReadAsync(cancellationToken).ConfigureAwait(false);

            //get reader buffer
            var buffer = result.Buffer;

            //check if any data where read
            if (buffer.Length > 0)
            {
                //rent byte array
                var array = _pool.Rent((int)buffer.Length);
                try
                {
                    //copy the buffer to newly created array
                    result.Buffer.CopyTo(array);

                    //advance reader
                    reader.AdvanceTo(result.Buffer.End,result.Buffer.End);

                    receives++;
                    Debug.WriteLine($"Receives {receives}");

                    //raise event and process the data
                    RaiseDataReceivedEvent(default, array, 0, (int)result.Buffer.Length);

                    Debug.WriteLine($"Receives {receives} - Sends {sends}");

                    BytesReceived += (ulong)buffer.Length;
                }
                catch
                {
                    throw;
                }
                finally
                {
                    //return the array to the pool
                    _pool.Return(array);
                }
            }

            // stop reader once there is no more data to read
            if (result.IsCompleted)
                break;
        }

        await reader.CompleteAsync().ConfigureAwait(false);
    }

Edit

Setting the PipeOptions to PipeScheduler.Inline for reader resolves the problem, would be interesting to know why.


来源: stackexchange

问:
MS Visual Studio 2022 .Net 6 Framework in Razor Pages Project, is this possible?
I have a question, is it possible to change the target framework for a C# project using Razor Pages from .Net 4.8 to 6.0?

In my project I want to copy files from the local disk to Azure Cloud BlobStorage and currently I can only do it with framework 6.0 or higher. I can't do the switch to the framework from 4.8 to 6.0 because it is not offered to me in this project. What can I do?

I hope that I am not the only one with this problem. Does anyone have any ideas to solve my problem?

Many greetings and thanks in advance

Code sample, this will work only with .Net 6.0 or higher

```<code>using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;

//Set <storage-account-name> to actual storage account name
var blobServiceClient = new BlobServiceClient("DefaultEndpointsProtocol=https;" +
    "AccountName=.....;AccountKey=.....;EndpointSuffix=core.windows.net");

//Create a name for the container
string containerName = "myFiles";

//Create the container and return a container client object
BlobContainerClient containerClient = await blobServiceClient.CreateBlobContainerAsync(containerName);

//Create a local file in the directory for uploading and downloading
string localPath = "c:\\DATA";
Directory.CreateDirectory(localPath);
string fileName = "myFile" + ".txt";
string localFilePath = Path.Combine(localPath, fileName);

//Write text to the file
await File.WriteAllTextAsync(localFilePath, "Hello, World!");

//Get a reference to a blob
BlobClient blobClient = containerClient.GetBlobClient(fileName);

Console.WriteLine("Uploading to Blob storage as blob:\n\t {0}\n", blobClient.Uri);

//Upload data from the local file
await blobClient.UploadAsync(localFilePath, true);

Console.WriteLine("Listing blobs...");

//List all blobs in the container
await foreach (BlobItem blobItem in containerClient.GetBlobsAsync())
{
    Console.WriteLine("\t" + blobItem.Name);
}

//Download the blob to a local file and append the string "DOWNLOADED" for compare
string downloadFilePath = localFilePath.Replace(".txt", "DOWNLOADED.txt");

Console.WriteLine("\nDownloading blob to\n\t{0}\n", downloadFilePath);

//Download the blob's contents and save it to a file
await blobClient.DownloadToAsync(downloadFilePath);

Console.WriteLine("Done");
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have a question, is it possible to change the target framework for a C# project using Razor Pages from .Net 4.8 to 6.0?

In my project I want to copy files from the local disk to Azure Cloud BlobStorage and currently I can only do it with framework 6.0 or higher. I can't do the switch to the framework from 4.8 to 6.0 because it is not offered to me in this project. What can I do?

I hope that I am not the only one with this problem. Does anyone have any ideas to solve my problem?

Many greetings and thanks in advance

Code sample, this will work only with .Net 6.0 or higher

using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;

//Set <storage-account-name> to actual storage account name
var blobServiceClient = new BlobServiceClient("DefaultEndpointsProtocol=https;" +
    "AccountName=.....;AccountKey=.....;EndpointSuffix=core.windows.net");

//Create a name for the container
string containerName = "myFiles";

//Create the container and return a container client object
BlobContainerClient containerClient = await blobServiceClient.CreateBlobContainerAsync(containerName);

//Create a local file in the directory for uploading and downloading
string localPath = "c:\\DATA";
Directory.CreateDirectory(localPath);
string fileName = "myFile" + ".txt";
string localFilePath = Path.Combine(localPath, fileName);

//Write text to the file
await File.WriteAllTextAsync(localFilePath, "Hello, World!");

//Get a reference to a blob
BlobClient blobClient = containerClient.GetBlobClient(fileName);

Console.WriteLine("Uploading to Blob storage as blob:\n\t {0}\n", blobClient.Uri);

//Upload data from the local file
await blobClient.UploadAsync(localFilePath, true);

Console.WriteLine("Listing blobs...");

//List all blobs in the container
await foreach (BlobItem blobItem in containerClient.GetBlobsAsync())
{
    Console.WriteLine("\t" + blobItem.Name);
}

//Download the blob to a local file and append the string "DOWNLOADED" for compare
string downloadFilePath = localFilePath.Replace(".txt", "DOWNLOADED.txt");

Console.WriteLine("\nDownloading blob to\n\t{0}\n", downloadFilePath);

//Download the blob's contents and save it to a file
await blobClient.DownloadToAsync(downloadFilePath);

Console.WriteLine("Done");


问:
How to get the email from a user / agent from a custom lookup field
We have a custom field with a type lookup in Zendesk connected to a form. Which gives us the possiblity to add another user object to a ticket.

But I am not able to figure out how to get that email address from that field in the ticket.

The documentation describes that if you select a relation you get a agent or user object. By getting this object, you can address the fields for that object.

But this is not working for us.

For example, the field ID 11963774080017
So to address the name in the field, we use {{ticket.ticket_field_11963774080017}}.

But when using the following {{ticket.ticket_field_11963774080017.user.email}}.
I am not able to fetch the user email.

Many thanks.


问:
Junit Mocking TypeReference Return Type
I am new to Junit , need help in mocking a simple method

public List < BingePageCacheDTO > getPages(String platform) {
  return cacheMapper.fetchData(platform, CacheMaps.HOME_PAGE, new TypeReference < List < BingePageCacheDTO >> () {});
}
```
<p>I am getting error in <code>thenReturn</code> method.</p>
<pre class="lang-java prettyprint-override"><code>List < BingePageCacheDTO > bingePageCacheDTOList = new ArrayList < > ();
bingePageCacheDTOList.add(new BingePageCacheDTO().setPageName("test"));
bingePageCacheDTOList.add(new BingePageCacheDTO().setPageName("page"));
Mockito.when(cacheMapper.fetchData("platform", CacheMaps.HOME_PAGE, new TypeReference < List < BingePageCacheDTO >> () {})).thenReturn(bingePageCacheDTOList);
</code>```

Error I am getting is :

```<code>error: no suitable method found for thenReturn(List<BingePageCacheDTO>)
        })).thenReturn(bingePageCacheDTOList);
           ^
    method OngoingStubbing.thenReturn(BingePageCacheDTO) is not applicable
      (argument mismatch; List<BingePageCacheDTO> cannot be converted to BingePageCacheDTO)
    method OngoingStubbing.thenReturn(BingePageCacheDTO,BingePageCacheDTO...) is not applicable
      (argument mismatch; List<BingePageCacheDTO> cannot be converted to BingePageCacheDTO)
</code>```

Can someone point my mistake here.

Title: Junit Mocking TypeReference Return Type

Body:
I am new to Junit , need help in mocking a simple method

public List < BingePageCacheDTO > getPages(String platform) {
  return cacheMapper.fetchData(platform, CacheMaps.HOME_PAGE, new TypeReference < List < BingePageCacheDTO >> () {});
}

I am getting error in thenReturn method.

List < BingePageCacheDTO > bingePageCacheDTOList = new ArrayList < > ();
bingePageCacheDTOList.add(new BingePageCacheDTO().setPageName("test"));
bingePageCacheDTOList.add(new BingePageCacheDTO().setPageName("page"));
Mockito.when(cacheMapper.fetchData("platform", CacheMaps.HOME_PAGE, new TypeReference < List < BingePageCacheDTO >> () {})).thenReturn(bingePageCacheDTOList);

Error I am getting is :

error: no suitable method found for thenReturn(List<BingePageCacheDTO>)
        })).thenReturn(bingePageCacheDTOList);
           ^
    method OngoingStubbing.thenReturn(BingePageCacheDTO) is not applicable
      (argument mismatch; List<BingePageCacheDTO> cannot be converted to BingePageCacheDTO)
    method OngoingStubbing.thenReturn(BingePageCacheDTO,BingePageCacheDTO...) is not applicable
      (argument mismatch; List<BingePageCacheDTO> cannot be converted to BingePageCacheDTO)

Can someone point my mistake here.


问:
Django app running on AWS elastic beanstalk cannot write to database
I have a Django app running on AWS elastic beanstalk. It was previously connected to a MySQL RDS instance. I have been through several steps to migrate the data from a MySQL instance to a PostgreSQL instance.
In brief I connected to the postgres instance and ran python manage.py migrate

I then ran python manage.py sqlflush and ran the resulting SQL commands

Then I imported a json fixture of content types from the MySQL db. I created the fixture (when connected to the MySQL db) with
python manage.py dumpdata contenttypes --indent=4 --natural-foreign > contenttype.json
and imported it into the PostgreSQL db with
python manage.py loaddata contenttype.json

The above preserves PKs and FKs

I then used AWS DMS to load the data from the MySQL instance to the PostgreSQL instance.

Using the Django app (e.g. through Django admin) all the data can be read from the Postgres instance. However, trying to post data to the database results in a 500 error.

Could this be a problem with security settings in AWS? It seems odd that I can read data from the DB but not post to it.

I've tried connecting to the DB using pgAdmin 4 with the same connection settings. I was able to use an INSERT statement to post to the database from there (but had to explicitly state the PK value)

Update

As suggested by Mark B the problem was Primary Keys. Many of the sequences in postgres had been reset to 1 as the current value. Finding the max value of the ID (PK) in each table and updating the corresponding sequence has got everything working. This question on sequences and primary keys was useful.


问:
copy city field value to be same as state field
i use in my woocommerce website state field only and i (unset) city field but it is affect on payment requirements so i need once customer enter value in state field , city field fill with same state value

```<code>add_filter( 'woocommerce_states', 'Saudi_arabia_cities_woocommerce' );
function Saudi_arabia_cities_woocommerce( $states ) {
  $states['SA'] = array(
    'RUH' => __('Riyadh', 'woocommerce') ,

  );

  return $states;
}
</code>```

i hope find solution

Body:
i use in my woocommerce website state field only and i (unset) city field but it is affect on payment requirements so i need once customer enter value in state field , city field fill with same state value

add_filter( 'woocommerce_states', 'Saudi_arabia_cities_woocommerce' );
function Saudi_arabia_cities_woocommerce( $states ) {
  $states['SA'] = array(
    'RUH' => __('Riyadh', 'woocommerce') ,

  );

  return $states;
}

i hope find solution


问:
I am outputting an altered tsv file to a new tsv file but the format is wrong
I've been working on this lab project to take in some tsv values of a "grade book" run some calculations, and finally output them to a new report.txt file but whenever I get to the end to print out my report.txt the format of the file doesn't match what I'd expect from a row by row tsv file and is instead a giant list.

So my question is how can I convert my list into a proper line by line tsv like below?

Barrett    Edan    70  45  59  F

Bradshaw    Reagan  96  97  88  A

Charlton    Caius   73  94  80  B

Mayo    Tyrese  88  61  36  D

Stern    Brenda  90  86  45  C

Averages: midterm1 83.40, midterm2 76.60, final 61.60

My input is commented out in the StudentInfo.tsv= below

My current output is listed below the code.

```<code># TODO: Declare any necessary variables here.

import csv
studentgrades=[]
s_grades=[]
all_grades=[]
all_grades_computed=[]

# TODO: Read a file name from the user and read the tsv file here.
#StudentInfo.tsv=   Barrett    Edan    70  45  59
#                   Bradshaw    Reagan  96  97  88
#                   Charlton    Caius   73  94  80
#                   Mayo    Tyrese  88  61  36
#                   Stern    Brenda  90  86  45

with open('StudentInfo.tsv', 'r') as file:
    studentgrades = csv.reader(file, delimiter='\t')
    sgrades=list(studentgrades)
    for row in sgrades:
        avg2=0
        rowstr='    '
        for i in row[2:]:
            avg2+=int(i)
            #print(i)
        #print(avg2)
        studentavg=float(int(avg2)/len(row[2:]))

        if studentavg >= 90:
            s_grades.append('A')
        elif 80<=studentavg<90:
            s_grades.append('B')
        elif 70<=studentavg<80:
            s_grades.append('C')
        elif 60<=studentavg<70:
            s_grades.append('D')
        else:
            s_grades.append('F')

        print('{} average: {:.2f}'.format(rowstr.join(row[0:2]), studentavg))
        #print('test length',len(row[2:]))
        #print(row[2:])
        print()

print(s_grades)
print(sgrades)

# for i in s_grades:
#     sgrades.append(i)
# print(sgrades)

for i in range(len(s_grades)):
    all_grades.append(str(sgrades[i])+str(s_grades[i]))
print(all_grades)
print()

# TODO: Compute student grades and exam averages, then output results to a text file here.
student1=sgrades[0]
student2=sgrades[1]
student3=sgrades[2]
student4=sgrades[3]
student5=sgrades[4]

print('Averages:',end=' ')
midterm1=(int(student1[2])+int(student2[2])+int(student3[2])+int(student4[2])+int(student5[2]))/len(sgrades)
#print(student1[2])
print('midterm1','{:.2f},'.format(midterm1),end=' ')
midterm2=(int(student1[3])+int(student2[3])+int(student3[3])+int(student4[3])+int(student5[3]))/len(sgrades)
#print(student1[3])
print('midterm2','{:.2f},'.format(midterm2),end=' ')
final=(int(student1[4])+int(student2[4])+int(student3[4])+int(student4[4])+int(student5[4]))/len(sgrades)
print('final','{:.2f}'.format(final))
all_grades_computed=['Averages:','midterm1','{:.2f},'.format(midterm1),'midterm2','{:.2f},'.format(midterm2), 'final','{:.2f}'.format(final)]

with open('report.txt', 'w+') as report:
        csv_writer=csv.writer(report, delimiter='\t')
        csv_writer.writerow(all_grades)
        csv_writer.writerow(all_grades_computed)

with open('report.txt','r') as report:
    reports=csv.reader(report, delimiter='\t')
    reportlist=list(reports)
    print(reportlist)
</code>```

Barrett    Edan average: 58.00

Bradshaw    Reagan average: 93.67

Charlton    Caius average: 82.33

Mayo    Tyrese average: 61.67

Stern    Brenda average: 73.67

['F', 'A', 'B', 'D', 'C']

[['Barrett', 'Edan', '70', '45', '59'], ['Bradshaw', 'Reagan', '96', '97', '88'], ['Charlton', 'Caius', '73', '94', '80'], ['Mayo', 'Tyrese', '88', '61', '36'], ['Stern', 'Brenda', '90', '86', '45']]

["['Barrett', 'Edan', '70', '45', '59']F", "['Bradshaw', 'Reagan', '96', '97', '88']A", "['Charlton', 'Caius', '73', '94', '80']B", "['Mayo', 'Tyrese', '88', '61', '36']D", "['Stern', 'Brenda', '90', '86', '45']C"]

Averages: midterm1 83.40, midterm2 76.60, final 61.60

[["['Barrett', 'Edan', '70', '45', '59']F", "['Bradshaw', 'Reagan', '96', '97', '88']A", "['Charlton', 'Caius', '73', '94', '80']B", "['Mayo', 'Tyrese', '88', '61', '36']D", "['Stern', 'Brenda', '90', '86', '45']C"], ['Averages:', 'midterm1', '83.40,', 'midterm2', '76.60,', 'final', '61.60']]

Body:
I've been working on this lab project to take in some tsv values of a "grade book" run some calculations, and finally output them to a new report.txt file but whenever I get to the end to print out my report.txt the format of the file doesn't match what I'd expect from a row by row tsv file and is instead a giant list.

So my question is how can I convert my list into a proper line by line tsv like below?

Barrett    Edan    70  45  59  F

Bradshaw    Reagan  96  97  88  A

Charlton    Caius   73  94  80  B

Mayo    Tyrese  88  61  36  D

Stern    Brenda  90  86  45  C

Averages: midterm1 83.40, midterm2 76.60, final 61.60

My input is commented out in the StudentInfo.tsv= below

My current output is listed below the code.

# TODO: Declare any necessary variables here.

import csv
studentgrades=[]
s_grades=[]
all_grades=[]
all_grades_computed=[]

# TODO: Read a file name from the user and read the tsv file here.
#StudentInfo.tsv=   Barrett    Edan    70  45  59
#                   Bradshaw    Reagan  96  97  88
#                   Charlton    Caius   73  94  80
#                   Mayo    Tyrese  88  61  36
#                   Stern    Brenda  90  86  45

with open('StudentInfo.tsv', 'r') as file:
    studentgrades = csv.reader(file, delimiter='\t')
    sgrades=list(studentgrades)
    for row in sgrades:
        avg2=0
        rowstr='    '
        for i in row[2:]:
            avg2+=int(i)
            #print(i)
        #print(avg2)
        studentavg=float(int(avg2)/len(row[2:]))

        if studentavg >= 90:
            s_grades.append('A')
        elif 80<=studentavg<90:
            s_grades.append('B')
        elif 70<=studentavg<80:
            s_grades.append('C')
        elif 60<=studentavg<70:
            s_grades.append('D')
        else:
            s_grades.append('F')

        print('{} average: {:.2f}'.format(rowstr.join(row[0:2]), studentavg))
        #print('test length',len(row[2:]))
        #print(row[2:])
        print()

print(s_grades)
print(sgrades)

# for i in s_grades:
#     sgrades.append(i)
# print(sgrades)

for i in range(len(s_grades)):
    all_grades.append(str(sgrades[i])+str(s_grades[i]))
print(all_grades)
print()

# TODO: Compute student grades and exam averages, then output results to a text file here.
student1=sgrades[0]
student2=sgrades[1]
student3=sgrades[2]
student4=sgrades[3]
student5=sgrades[4]

print('Averages:',end=' ')
midterm1=(int(student1[2])+int(student2[2])+int(student3[2])+int(student4[2])+int(student5[2]))/len(sgrades)
#print(student1[2])
print('midterm1','{:.2f},'.format(midterm1),end=' ')
midterm2=(int(student1[3])+int(student2[3])+int(student3[3])+int(student4[3])+int(student5[3]))/len(sgrades)
#print(student1[3])
print('midterm2','{:.2f},'.format(midterm2),end=' ')
final=(int(student1[4])+int(student2[4])+int(student3[4])+int(student4[4])+int(student5[4]))/len(sgrades)
print('final','{:.2f}'.format(final))
all_grades_computed=['Averages:','midterm1','{:.2f},'.format(midterm1),'midterm2','{:.2f},'.format(midterm2), 'final','{:.2f}'.format(final)]

with open('report.txt', 'w+') as report:
        csv_writer=csv.writer(report, delimiter='\t')
        csv_writer.writerow(all_grades)
        csv_writer.writerow(all_grades_computed)

with open('report.txt','r') as report:
    reports=csv.reader(report, delimiter='\t')
    reportlist=list(reports)
    print(reportlist)

Barrett    Edan average: 58.00

Bradshaw    Reagan average: 93.67

Charlton    Caius average: 82.33

Mayo    Tyrese average: 61.67

Stern    Brenda average: 73.67

['F', 'A', 'B', 'D', 'C']

[['Barrett', 'Edan', '70', '45', '59'], ['Bradshaw', 'Reagan', '96', '97', '88'], ['Charlton', 'Caius', '73', '94', '80'], ['Mayo', 'Tyrese', '88', '61', '36'], ['Stern', 'Brenda', '90', '86', '45']]

["['Barrett', 'Edan', '70', '45', '59']F", "['Bradshaw', 'Reagan', '96', '97', '88']A", "['Charlton', 'Caius', '73', '94', '80']B", "['Mayo', 'Tyrese', '88', '61', '36']D", "['Stern', 'Brenda', '90', '86', '45']C"]

Averages: midterm1 83.40, midterm2 76.60, final 61.60

[["['Barrett', 'Edan', '70', '45', '59']F", "['Bradshaw', 'Reagan', '96', '97', '88']A", "['Charlton', 'Caius', '73', '94', '80']B", "['Mayo', 'Tyrese', '88', '61', '36']D", "['Stern', 'Brenda', '90', '86', '45']C"], ['Averages:', 'midterm1', '83.40,', 'midterm2', '76.60,', 'final', '61.60']]


问:
How to know if the TCP transmission succeded with netconn LWIP?
I'm using the API netconn of LWIP with a STM32F746NNG-NUCLEO.

I can send some data over TCP/IP using netconn_write() in the sunny case (no disconnection, perfect weather for 4G modem). But, in a case where the transmission failed, how can I know that it failed?

Because, at the moment, when I simulate a disconnection of my server, netconn_write() always returns an OK, which is clearly not right because data had never been received by the server.

Does anybody know how to fix it?


问:
Why do I get the error message "Cannot connect to the Docker daemon at unix:///var/run/docker.sock." while running Docker Desktop on Windows
I am new to docker. I am trying to get the portainer agent running on a windows machine running docker desktop and I am getting this error message:

```<code>"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
</code>```

I am a bit puzzled why it is looking to connect to a unix daemon on a windows machine?

Anyone out there knows how I can this addressed? Thank you in advance for your help in this matter.

Body:
I am new to docker. I am trying to get the portainer agent running on a windows machine running docker desktop and I am getting this error message:

"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"

I am a bit puzzled why it is looking to connect to a unix daemon on a windows machine?

Anyone out there knows how I can this addressed? Thank you in advance for your help in this matter.


问:
What's the main difference between WorksheetFunction.Index() vs Application.Index()
I am using Microsoft 365 Excel. In VBA, WorksheetFunction.Index(arr, rows, 1) doesn't work while Application.Index(arr, rows, 1) works, however, WorksheetFunction.Index(arr, 1, columns) works fine, where columns and rows are arrays.

I am working on these operations with WorksheetFunction.TextJoin(...).

(1) array of rows: working - resulting delimiter separated list where rows are row positions of arr:

```<code>result = WorksheetFunction.TextJoin(Delimiter, True, Application.Index(arr, rows, 1))
</code>```

'' Not Working - resulting 0 where I expect a delimiter separated list:

```<code>result = WorksheetFunction.TextJoin(Delimiter, True, WorksheetFunction.Index(arr, rows, 1))
</code>```

WorksheetFunction.Index(arr, rows, 1) in the code above results in nothing while Application.Index(arr, rows, 1) results in an array of rows-indicated values in arr.

(2) array of columns: working

```<code>result = WorksheetFunction.TextJoin(Delimiter, True, WorksheetFunction.Index(arr, 1, columns))
</code>```

I am looking for a consistent and robust solution and technical explanations if possible. What's the clear distinction among these 3 approaches, Application.Index(), WorksheetFunction.Index(), and Applicaiton.WorksheetFunction.Index()? WorksheetFunction.Index(Arr, rows, 1) doesn't work but WorksheetFunction.Index(Arr, 1, columns) works fine in the VBA. Why? For consistency and robustness, should I keep Application.Index() approach? Is this the choice of Microsoft? Are there any technical documents related to this matter? I appreciate any technical comments.

Body:
I am using Microsoft 365 Excel. In VBA, WorksheetFunction.Index(arr, rows, 1) doesn't work while Application.Index(arr, rows, 1) works, however, WorksheetFunction.Index(arr, 1, columns) works fine, where columns and rows are arrays.

I am working on these operations with WorksheetFunction.TextJoin(...).

(1) array of rows: working - resulting delimiter separated list where rows are row positions of arr:

result = WorksheetFunction.TextJoin(Delimiter, True, Application.Index(arr, rows, 1))

'' Not Working - resulting 0 where I expect a delimiter separated list:

result = WorksheetFunction.TextJoin(Delimiter, True, WorksheetFunction.Index(arr, rows, 1))

WorksheetFunction.Index(arr, rows, 1) in the code above results in nothing while Application.Index(arr, rows, 1) results in an array of rows-indicated values in arr.

(2) array of columns: working

result = WorksheetFunction.TextJoin(Delimiter, True, WorksheetFunction.Index(arr, 1, columns))

I am looking for a consistent and robust solution and technical explanations if possible. What's the clear distinction among these 3 approaches, Application.Index(), WorksheetFunction.Index(), and Applicaiton.WorksheetFunction.Index()? WorksheetFunction.Index(Arr, rows, 1) doesn't work but WorksheetFunction.Index(Arr, 1, columns) works fine in the VBA. Why? For consistency and robustness, should I keep Application.Index() approach? Is this the choice of Microsoft? Are there any technical documents related to this matter? I appreciate any technical comments.


问:
Transformer-Model for hierarchical text
I have a NLP task/idea in mind, where the input and output text is structured purely hierarchically, like multi-level bulletpoint lists or a table of content.
The question is: Is there any resaetch for this particular type of text for transformer modells? I am especially interested in possibilities to encode the position to represent the multi-level structure. Furthermore, do you know of any datasets containing such text samples (e.g. table of contents; multi-level notes; mind-maps; ...)?

I have already tried multiple combinations of the following search terms: "hierarchical text","multilevel lists", "nested list", "nlp", "transformer", "position encoding" but was unable to find any useful information.

Thank you for your help.

Title: Transformer-Model for hierarchical text


问:
Setting up Firebase push notifications for custom Matrix client
I've found the documentation for push gateways:

https://spec.matrix.org/v1.5/push-gateway-api/

and a couple repos implementing it;

https://gitlab.com/famedly/company/backend/services/famedly-push-gateway/-/tree/master/.

https://github.com/matrix-org/sygnal

Setting up a push gateway seems to be the missing link for us. However, before we get into hosting our own server, I'm wondering - Is it possible to create a custom Matrix client with push notifications without hosting a push gateway?

I have tried going through the synaps and didn’t see any link for that.


问:
Retried waiting for GCLocker too often allocating 12488753 words
I see the follow output on my Java console. What this means? Why it occur?</p>
```<code>[477.615s][warning][gc,alloc] mythreadname: Retried waiting for GCLocker too often allocating 12488753 words
[519.628s][warning][gc,alloc] mythreadname: Retried waiting for GCLocker too often allocating 12488753 words
</code>```

Body:
I see the follow output on my Java console. What this means? Why it occur?

[477.615s][warning][gc,alloc] mythreadname: Retried waiting for GCLocker too often allocating 12488753 words
[519.628s][warning][gc,alloc] mythreadname: Retried waiting for GCLocker too often allocating 12488753 words


问:
Error in installing Angular language service
Tried to install the angular language service but shooted by an error.

tried the installation process in two ways 1) view -> extension -> and then installing

tried manually by command npm i --save-dev @angular/language-service

got the error in both the cases


问:
Can't figure out how to fix Error: P1001: Can't reach database server at `localhost`:`5432`
I am running into the error:
Error: P1001: Can't reach database server atlocalhost:5432`

Please make sure your database server is running at localhost:5432.
`

I am trying to use the command "npx prisma migrate dev" however it continueously throws the error stated above.

schema.prisma file:
datasource db { provider = "postgresql" url = env("DATABASE_URL") }

.env file:
DATABASE_URL="postgresql://[username]:[password]@localhost:5432/[db]?schema=public"

Any help or insight as to how to fix this error would be greatly appreciated!


问:
Recharts Radar - Invalid Value for <line> attribute x1=NaN
I'm trying to get a radar chart in React Recharts. My data looks like:

```<code>[{N_DNA: 2, T_DNA: 1, T_RNA: 3, subject: "A1"},
{N_DNA: 1, T_DNA: 3, T_RNA: 2, subject: "A2"},
{N_DNA: 4, T_DNA: 4, T_RNA: 1, subject: "B1"},
{N_DNA: 6, T_DNA: 8, T_RNA: 7, subject: "B2"}]
</code>```

My React code is:

```<code><ResponsiveContainer width={"95%"} height={"100%"}>
                    <RadarChart
                        cx={300}
                        cy={250}
                        outerRadius={150}
                        width={500}
                        height={500}
                        data={data}
                    >
                        <PolarGrid />
                        <PolarAngleAxis dataKey="subject" />
                        <PolarRadiusAxis />
                        <Radar
                            name="Mike"
                            dataKey="N_DNA"
                            stroke="red"
                            fill="none"
                            fillOpacity={0.3}
                        />
                        <Radar
                            name="Jake"
                            dataKey="T_DNA"
                            stroke="blue"
                            fill="none"
                            fillOpacity={0.3}
                        />
                        <Radar
                            name="Jake"
                            dataKey="T_RNA"
                            stroke="green"
                            fill="none"
                            fillOpacity={0.3}
                        />
                    </RadarChart>
                </ResponsiveContainer>
</code>```

When I try to recreate this in code sandbox, it works fine. But it throws an error on the browser.

The error is Error: Invalid value for <line> attribute x1="NaN"

CodeSandbox: https://codesandbox.io/s/simple-radar-chart-forked-mkieb8?file=/src/App.tsx

Body:
I'm trying to get a radar chart in React Recharts. My data looks like:

[{N_DNA: 2, T_DNA: 1, T_RNA: 3, subject: "A1"},
{N_DNA: 1, T_DNA: 3, T_RNA: 2, subject: "A2"},
{N_DNA: 4, T_DNA: 4, T_RNA: 1, subject: "B1"},
{N_DNA: 6, T_DNA: 8, T_RNA: 7, subject: "B2"}]

My React code is:

<ResponsiveContainer width={"95%"} height={"100%"}>
                    <RadarChart
                        cx={300}
                        cy={250}
                        outerRadius={150}
                        width={500}
                        height={500}
                        data={data}
                    >
                        <PolarGrid />
                        <PolarAngleAxis dataKey="subject" />
                        <PolarRadiusAxis />
                        <Radar
                            name="Mike"
                            dataKey="N_DNA"
                            stroke="red"
                            fill="none"
                            fillOpacity={0.3}
                        />
                        <Radar
                            name="Jake"
                            dataKey="T_DNA"
                            stroke="blue"
                            fill="none"
                            fillOpacity={0.3}
                        />
                        <Radar
                            name="Jake"
                            dataKey="T_RNA"
                            stroke="green"
                            fill="none"
                            fillOpacity={0.3}
                        />
                    </RadarChart>
                </ResponsiveContainer>

When I try to recreate this in code sandbox, it works fine. But it throws an error on the browser.

The error is Error: Invalid value for <line> attribute x1="NaN"

CodeSandbox: https://codesandbox.io/s/simple-radar-chart-forked-mkieb8?file=/src/App.tsx


问:
Producer is closed forcefully - Mirror Maker
I have mirror maker configured to read the messages from Azure Event Hub and write it to the Kafka cluster.
On the Mirror Maker i am seeing the following error.

```<code>java.lang.IllegalStateException: Producer is closed forcefully.
        at org.apache.kafka.clients.producer.internals.RecordAccumulator.abortBatches(RecordAccumulator.java:696)
        at org.apache.kafka.clients.producer.internals.RecordAccumulator.abortIncompleteBatches(RecordAccumulator.java:683)
        at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:185)
        at java.base/java.lang.Thread.run(Thread.java:829)
</code>```

Consumer.Properties

```<code>bootstrap.servers=<Event Hub Name>:9093
group.id=<group name>
client.id=mirror_maker_consumer
exclude.internal.topics=true
auto.offset.reset=latest
request.timeout.ms=60000
sasl.mechanism=PLAIN
security.protocol=SASL_SSL
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="Event Hub Connection String";
</code>```

Producer.properties

```<code>bootstrap.servers= <<kafka Cluster>>
producer.type=async
batch.size=1000
buffer.memory=335544320
request.timeout.ms = 60000
transaction.timeout.ms = 90000
max.in.flight.requests.per.connection=1
retries=11
acks=1
max.request.size=1048576000
message.max.bytes=1048576000
</code>```

Body:
I have mirror maker configured to read the messages from Azure Event Hub and write it to the Kafka cluster.
On the Mirror Maker i am seeing the following error.

java.lang.IllegalStateException: Producer is closed forcefully.
        at org.apache.kafka.clients.producer.internals.RecordAccumulator.abortBatches(RecordAccumulator.java:696)
        at org.apache.kafka.clients.producer.internals.RecordAccumulator.abortIncompleteBatches(RecordAccumulator.java:683)
        at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:185)
        at java.base/java.lang.Thread.run(Thread.java:829)

Consumer.Properties

bootstrap.servers=<Event Hub Name>:9093
group.id=<group name>
client.id=mirror_maker_consumer
exclude.internal.topics=true
auto.offset.reset=latest
request.timeout.ms=60000
sasl.mechanism=PLAIN
security.protocol=SASL_SSL
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="Event Hub Connection String";

Producer.properties

bootstrap.servers= <<kafka Cluster>>
producer.type=async
batch.size=1000
buffer.memory=335544320
request.timeout.ms = 60000
transaction.timeout.ms = 90000
max.in.flight.requests.per.connection=1
retries=11
acks=1
max.request.size=1048576000
message.max.bytes=1048576000


问:
/system/bin/sh crashes causing the program to crash. no clue
I'm using pjsip to make a video call on a device with android version 6.0. when I execute the call. Most likely my program crashes without error. The captured stack is /system/bin/sh. But I'm pretty sure I'm not using a shell command during this invocation. From the logs, I have no clue to solve the problem at all. I wonder where this thing /system/bin/sh might be causing. What are the consequences of triggering this. Please help me if you have any suggestion about it. thanks. Below is my log.

com.gh.z is my package name

My program was running fine until the crash started, I saw a 13 error semaphore in libc, then the audio hardware and camera device stopped one after another, the system's process group started killing processes, my application pid was 4518, and the ActivityManager told My process died, but my program did not report an error log, and then printed the crash of /system/bin/sh. I don't see any problem.

```<code>2023-01-06 10:59:15.778 4518-5226/com.gh.z. I/System.out: sec data len：100811
2023-01-06 10:59:15.841 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:89
2023-01-06 10:59:15.842 4518-4998/com.gh.z. I/System.out: Cpu Temp：65
2023-01-06 10:59:15.842 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:15.942 4518-4926/com.gh.z. D/SipCall: onCallTsxState:5
2023-01-06 10:59:15.942 4518-4926/com.gh.z. D/PjsipTalkBack: onCallTsxState: prm:
2023-01-06 10:59:16.819 4518-5226/com.gh.z. I/System.out: sec data len：93210
2023-01-06 10:59:16.841 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:88
2023-01-06 10:59:16.842 4518-4998/com.gh.z. I/System.out: Cpu Temp：65
2023-01-06 10:59:16.842 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:17.110 4518-4926/com.gh.z. D/SipCall: onCallTsxState:5
2023-01-06 10:59:17.110 4518-4926/com.gh.z. D/PjsipTalkBack: onCallTsxState: prm:
2023-01-06 10:59:17.598 4518-6155/com.gh.z. D/pjsip-extern_recorder: 10:59:17.597   Master/sound !Buffer size adjusted from 1159 to 952 (eff_cnt=819)
2023-01-06 10:59:17.836 4518-5226/com.gh.z. I/System.out: sec data len：115925
2023-01-06 10:59:17.841 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:87
2023-01-06 10:59:17.842 4518-4998/com.gh.z. I/System.out: Cpu Temp：65
2023-01-06 10:59:17.842 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:18.842 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:86
2023-01-06 10:59:18.843 4518-4998/com.gh.z. I/System.out: Cpu Temp：64
2023-01-06 10:59:18.843 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:18.852 4518-5226/com.gh.z. I/System.out: sec data len：87093
2023-01-06 10:59:19.174 4518-4925/com.gh.z. D/pjsip-ev_thread: 10:59:19.173  pjsua_media.c !Sending video keyframe request via SIP INFO
2023-01-06 10:59:19.175 4518-4925/com.gh.z. D/pjsip-ev_thread: 10:59:19.174   pjsua_call.c  Call 0 sending INFO request..
2023-01-06 10:59:19.179 4518-4925/com.gh.z. D/pjsip-ev_thread: 10:59:19.178   pjsua_core.c  ...TX 799 bytes Request msg INFO/cseq=4208 (tdta0xe0cab064) to UDP 58.112.104.145:5060:
    INFO sip:1611186079963152384@219.137.62.101:41746;transport=tls SIP/2.0
    Via: SIP/2.0/UDP 219.137.62.101:37438;rport;branch=z9hG4bKPjdc6d2d71-3838-4313-90d6-7a1ce0db646d
    Max-Forwards: 70
    From: <sip:1611205501427777536@open.sip.com.>;tag=a4243722-92e6-49e8-a4bf-7b6d2f4c441e
    To: <sip:1611186079963152384@open.sip.com.>;tag=YESLbFyPL
    Call-ID: UzglGh50Q-
    CSeq: 4208 INFO
    Route: <sip:58.112.104.145:5060;lr;r2=on;nat=yes;did=9a1.9d3dd184>
    Route: <sip:58.112.104.145:8061;transport=tls;lr;r2=on;nat=yes;did=9a1.9d3dd184>
    User-Agent: Pjsua2 Android 2.12-dev
    Content-Type: application/media_control+xml
    Content-Length:   146

    <?xml version="1.0" encoding="utf-8" ?><media_control><vc_primitive><to_encoder><picture_fast_update/></to_encoder></vc_primitive></media_control>
    --end msg--
2023-01-06 10:59:19.181 4518-4925/com.gh.z. D/SipCall: onCallTsxState:5
2023-01-06 10:59:19.181 4518-4925/com.gh.z. D/PjsipTalkBack: onCallTsxState: prm:
2023-01-06 10:59:19.248 4518-4926/com.gh.z. D/pjsip-pjsua_0: 10:59:19.246   pjsua_core.c !.RX 444 bytes Response msg 200/INFO/cseq=4208 (rdata0xe12f5014) from UDP 58.112.104.145:5060:
    SIP/2.0 200 Ok
    Via: SIP/2.0/UDP 219.137.62.101:37438;received=219.137.62.101;rport=37438;branch=z9hG4bKPjdc6d2d71-3838-4313-90d6-7a1ce0db646d
    From: <sip:1611205501427777536@open.sip.com.>;tag=a4243722-92e6-49e8-a4bf-7b6d2f4c441e
    To: <sip:1611186079963152384@open.sip.com.>;tag=YESLbFyPL
    Call-ID: UzglGh50Q-
    CSeq: 4208 INFO
    User-Agent: Unknown
    Supported: replaces, outbound, gruu, record-aware
    Content-Length: 0

    --end msg--
2023-01-06 10:59:19.249 4518-4926/com.gh.z. D/SipCall: onCallTsxState:5
2023-01-06 10:59:19.249 4518-4926/com.gh.z. D/PjsipTalkBack: onCallTsxState: prm:SIP/2.0 200 Ok
    Via: SIP/2.0/UDP 219.137.62.101:37438;received=219.137.62.101;rport=37438;branch=z9hG4bKPjdc6d2d71-3838-4313-90d6-7a1ce0db646d
    From: <sip:1611205501427777536@open.sip.com.>;tag=a4243722-92e6-49e8-a4bf-7b6d2f4c441e
    To: <sip:1611186079963152384@open.sip.com.>;tag=YESLbFyPL
    Call-ID: UzglGh50Q-
    CSeq: 4208 INFO
    User-Agent: Unknown
    Supported: replaces, outbound, gruu, record-aware
    Content-Length: 0
2023-01-06 10:59:19.843 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:85
2023-01-06 10:59:19.844 4518-4998/com.gh.z. I/System.out: Cpu Temp：65
2023-01-06 10:59:19.844 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:19.871 4518-5226/com.gh.z. I/System.out: sec data len：115555
2023-01-06 10:59:20.039 4518-4926/com.gh.z. D/SipCall: onCallTsxState:5
2023-01-06 10:59:20.039 4518-4926/com.gh.z. D/PjsipTalkBack: onCallTsxState: prm:
2023-01-06 10:59:20.846 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:84
2023-01-06 10:59:20.847 4518-4998/com.gh.z. I/System.out: Cpu Temp：64
2023-01-06 10:59:20.847 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:20.902 4518-5226/com.gh.z. I/System.out: sec data len：96649
2023-01-06 10:59:21.194 30818-32015/system_process I/WindowState: WIN DEATH: Window{147880d u0 com.gh.z./com.gh.z..ui.activity.MainActivity}
2023-01-06 10:59:21.195 30737-3449/? E/OMXNodeInstance: !!! Observer died. Quickly, do something, ... anything...
2023-01-06 10:59:21.197 30818-31415/system_process D/WifiService: Client connection lost with reason: 4
2023-01-06 10:59:21.198 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.198 30818-31865/system_process I/libprocessgroup: Killing pid 4691 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.198 30818-31865/system_process I/libprocessgroup: Killing pid 4813 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.198 30818-31865/system_process I/libprocessgroup: Killing pid 6054 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.198 30818-31073/system_process W/InputDispatcher: channel 'b74bc0 com.gh.z./com.gh.z..ui.activity.MonitoringActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
2023-01-06 10:59:21.198 30818-31073/system_process E/InputDispatcher: channel 'b74bc0 com.gh.z./com.gh.z..ui.activity.MonitoringActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2023-01-06 10:59:21.199 30818-31899/system_process D/GraphicsStats: Buffer count: 4
2023-01-06 10:59:21.200 30737-6140/? D/awplayer: <ComponentThread:2560>: x set state command, cmd = 0, pCmdData = 2.
2023-01-06 10:59:21.202 1623-1623/? I/Zygote: Process 4518 exited due to signal (11)
2023-01-06 10:59:21.203 30737-6158/? D/audio_hw_primary: >>>>>> select_device
    --------- beginning of crash
2023-01-06 10:59:21.205 4704-4704/? A/libc: Fatal signal 13 (SIGPIPE), code 0 in tid 4704 (sh)
2023-01-06 10:59:21.206 30737-6158/? V/audio_hw_primary: active_output, ****LINE:1050,FUNC:select_device, adev->out_device:2
2023-01-06 10:59:21.206 30737-6158/? V/audio_hw_primary: ****LINE:1056,FUNC:select_device, headset_on:0, headphone_on:0, speaker_on:2, earpiece_on:0, bt_on:0
2023-01-06 10:59:21.206 30737-6158/? V/audio_hw_primary: ****LINE:1083,FUNC:select_device, output_device_id:6
2023-01-06 10:59:21.206 30737-6158/? V/audio_hw_primary: NORMAL mode, ****LINE:1087,FUNC:select_device, adev->out_device:2
2023-01-06 10:59:21.211 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.214 30737-31108/? D/V4L2CameraDevice: V4L2CameraDevice::stopDevice
2023-01-06 10:59:21.214 30737-30889/? W/CameraHardware: CMD_QUEUE_STOP_FACE_DETECTE failed, mFaceDetection not opened.
2023-01-06 10:59:21.214 30737-31108/? W/V4L2CameraDevice: wait until capture thread pause or exit
2023-01-06 10:59:21.216 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.218 30818-30838/system_process I/WindowState: WIN DEATH: Window{b74bc0 u0 com.gh.z./com.gh.z..ui.activity.MonitoringActivity}
2023-01-06 10:59:21.218 30818-30838/system_process W/InputDispatcher: Attempted to unregister already unregistered input channel 'b74bc0 com.gh.z./com.gh.z..ui.activity.MonitoringActivity (server)'
2023-01-06 10:59:21.218 30818-30838/system_process W/WindowManager: Force-removing child win Window{8260a4a u0 SurfaceView} from container Window{b74bc0 u0 com.gh.z./com.gh.z..ui.activity.MonitoringActivity}
2023-01-06 10:59:21.222 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.227 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.230 30818-32069/system_process W/WindowManager: Failed looking up window
    java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@d9ff0f9 does not exist
        at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8764)
        at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8755)
        at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1209)
        at android.os.BinderProxy.sendDeathNotice(Binder.java:558)
2023-01-06 10:59:21.230 30818-32069/system_process I/WindowState: WIN DEATH: null
2023-01-06 10:59:21.232 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.238 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.242 30737-30884/? W/V4L2CameraDevice: should stop capture now
2023-01-06 10:59:21.243 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.249 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.254 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.260 1629-1629/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2023-01-06 10:59:21.260 30818-31865/system_process I/ActivityManager: Process com.gh.z. (pid 4518) has died
2023-01-06 10:59:21.260 1629-1629/? A/DEBUG: Build fingerprint: 'Allwinner/tulip_p2/tulip-p2:6.0.1/MOB30J/20211026:eng/test-keys'
2023-01-06 10:59:21.260 1629-1629/? A/DEBUG: Revision: '0'
2023-01-06 10:59:21.260 1629-1629/? A/DEBUG: ABI: 'arm64'
2023-01-06 10:59:21.260 30818-31865/system_process W/ActivityManager: Scheduling restart of crashed service com.gh.z./org.eclipse.paho.android.service.MqttService in 1000ms
2023-01-06 10:59:21.261 30818-31865/system_process W/ActivityManager: Force removing ActivityRecord{9054b8d u0 com.gh.z./.ui.activity.MonitoringActivity t11}: app died, no saved state
2023-01-06 10:59:21.261 30818-31488/system_process W/NativeCrashListener: Couldn't find ProcessRecord for pid 4704
2023-01-06 10:59:21.262 1629-1629/? A/DEBUG: pid: 4704, tid: 4704, name: sh  >>> sh <<<
2023-01-06 10:59:21.262 1629-1629/? E/DEBUG: AM write failed: Broken pipe
2023-01-06 10:59:21.262 1629-1629/? A/DEBUG: signal 13 (SIGPIPE), code 0 (SI_USER), fault addr --------
2023-01-06 10:59:21.263 1619-1657/? D/Sayeye: current scense is (Normal)
2023-01-06 10:59:21.263 1619-1657/? E/Sayeye: failed to open /sys/devices/soc.0/cpu_budget_cool.17/roomage, No such file or directory
2023-01-06 10:59:21.263 1619-1657/? E/Sayeye: failed to open /sys/devices/soc.0/1c2ac00.twi/i2c-0/0-0040/runtime_suspend, No such file or directory
2023-01-06 10:59:21.263 1619-1657/? D/Sayeye: Scense (Normal) state set succeed
2023-01-06 10:59:21.264 30818-30854/system_process I/DynamicPManagerService: Current Scense:normal
2023-01-06 10:59:21.265 30737-31927/? V/codec_audio_iface: phone_record_enable, line: 165
2023-01-06 10:59:21.265 30737-31927/? D/audio_hw_primary: adev_close_input_stream set voice record status
2023-01-06 10:59:21.268 30737-31735/? V/codec_audio_iface: phone_record_enable, line: 165
2023-01-06 10:59:21.268 30737-31735/? D/audio_hw_primary: adev_close_input_stream set voice record status
2023-01-06 10:59:21.268 1629-1629/? A/DEBUG:     x0   ffffffffffffffe0  x1   0000007f79858000  x2   0000000000000146  x3   0000000000000000
2023-01-06 10:59:21.268 1629-1629/? A/DEBUG:     x4   0000007f79bf3000  x5   0000000000000001  x6   0000000000000000  x7   0000000000000000
2023-01-06 10:59:21.268 1629-1629/? A/DEBUG:     x8   0000000000000040  x9   0000000000000ba0  x10  0000000000000000  x11  0000007f79a02380
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     x12  0000000000000000  x13  0000000000000000  x14  0000000000000001  x15  000000000000005f
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     x16  0000005585c40b50  x17  0000007f79b7828c  x18  0000000000000009  x19  0000000000000061
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     x20  0000000000000146  x21  0000007f79858000  x22  0000007f79d4d0a8  x23  0000000000000019
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     x24  0000000000000000  x25  0000000000000004  x26  0000007f79a31248  x27  0000007f79858000
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     x28  0000007f79a0c200  x29  0000007ffff92ce0  x30  0000005585c0a360
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     sp   0000007ffff92ce0  pc   0000007f79b78294  pstate 0000000000000000
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG: backtrace:
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #00 pc 000000000006a294  /system/lib64/libc.so (write+8)
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #01 pc 000000000001f35c  /system/bin/sh (c_cat+216)
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #02 pc 000000000001522c  /system/bin/sh
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #03 pc 0000000000017ba4  /system/bin/sh
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #04 pc 0000000000016edc  /system/bin/sh
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #05 pc 000000000002a2d4  /system/bin/sh
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #06 pc 000000000000629c  /system/bin/sh (main+1848)
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #07 pc 000000000001bc98  /system/lib64/libc.so (__libc_init+100)
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #08 pc 0000000000006860  /system/bin/sh
2023-01-06 10:59:21.280 30818-31865/system_process I/ActivityManager: Start proc 6286:com.gh.z./u0a40 for activity com.gh.z./.ui.activity.MainActivity
2023-01-06 10:59:21.283 6286-6286/? I/art: Late-enabling JIT
2023-01-06 10:59:21.296 30737-6140/? D/awplayer: <ComponentThread:2560>: x set state command, cmd = 0, pCmdData = 1.
2023-01-06 10:59:21.300 6286-6286/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
2023-01-06 10:59:21.307 30737-31103/? E/AudioFlinger: no wake lock to update!
2023-01-06 10:59:21.354 1618-1686/? I/[Gralloc]: ion_alloc from ion_client:19 via heap type DMA(mask:16) for 2457600 Bytes cached buffer successfully, usage = 0x00000933
2023-01-06 10:59:21.363 30737-6154/? D/CallbackNotifier: savePictureThread exit, line: 1515
2023-01-06 10:59:21.365 30737-31108/? I/CameraFlashlight: Destroying camera 0
2023-01-06 10:59:21.387 1629-1629/? A/DEBUG: Tombstone written to: /data/tombstones/tombstone_01
2023-01-06 10:59:21.388 30818-30867/system_process I/BootReceiver: Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
2023-01-06 10:59:21.396 6286-6286/com.gh.z. I/MultiDex: VM with version 2.1.0 has multidex support
2023-01-06 10:59:21.396 6286-6286/com.gh.z. I/MultiDex: Installing application
2023-01-06 10:59:21.397 6286-6286/com.gh.z. I/MultiDex: VM has multidex support, MultiDex support library is disabled.
2023-01-06 10:59:21.397 30737-3449/? D/awplayer: <component_deinit:2055>: component_deinit
2023-01-06 10:59:21.405 30737-6140/? D/awplayer: <ComponentThread:2989>: x stop command.
2023-01-06 10:59:21.405 30737-6141/? D/awplayer: <ComponentVencThread:3895>: vencThread detect nStopFlag[1], exit!
2023-01-06 10:59:21.406 30737-3449/? D/awplayer: <check_lib_unload:394>:  Unloading the dynamic library for OMX.allwinner.video.encoder.avc
2023-01-06 10:59:21.433 6286-6286/com.gh.z. W/ActivityThread: ClassLoader.getResources: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
2023-01-06 10:59:21.467 30737-31108/? D/HALCameraFactory: There is 1 attached cameras and 0 removable cameras
2023-01-06 10:59:21.467 30737-31108/? I/CameraService: disconnect: Disconnected client for camera 0 for PID 4518
2023-01-06 10:59:21.468 30737-31108/? D/NuPlayerDriver: reset(0xf61180a0)
2023-01-06 10:59:21.468 30737-31108/? D/NuPlayerDriver: notifyListener_l(0xf61180a0), (8, 0, 0)
2023-01-06 10:59:21.468 30737-6147/? D/NuPlayerDriver: notifyResetComplete(0xf61180a0)
2023-01-06 10:59:21.469 30737-31108/? D/NuPlayerDriver: reset(0xf61185e0)
2023-01-06 10:59:21.469 30737-31108/? D/NuPlayerDriver: notifyListener_l(0xf61185e0), (8, 0, 0)
2023-01-06 10:59:21.470 30737-6149/? D/NuPlayerDriver: notifyResetComplete(0xf61185e0)
2023-01-06 10:59:21.470 30737-31108/? D/NuPlayerDriver: reset(0xf6118640)
2023-01-06 10:59:21.470 30737-31108/? D/NuPlayerDriver: notifyListener_l(0xf6118640), (8, 0, 0)
2023-01-06 10:59:21.471 30737-6151/? D/NuPlayerDriver: notifyResetComplete(0xf6118640)
2023-01-06 10:59:21.472 30737-31108/? E/CameraService: binderDied: Java client's binder died, removing it from the list of active clients
</code>```

Body:
I'm using pjsip to make a video call on a device with android version 6.0. when I execute the call. Most likely my program crashes without error. The captured stack is /system/bin/sh. But I'm pretty sure I'm not using a shell command during this invocation. From the logs, I have no clue to solve the problem at all. I wonder where this thing /system/bin/sh might be causing. What are the consequences of triggering this. Please help me if you have any suggestion about it. thanks. Below is my log.

com.gh.z is my package name

My program was running fine until the crash started, I saw a 13 error semaphore in libc, then the audio hardware and camera device stopped one after another, the system's process group started killing processes, my application pid was 4518, and the ActivityManager told My process died, but my program did not report an error log, and then printed the crash of /system/bin/sh. I don't see any problem.

2023-01-06 10:59:15.778 4518-5226/com.gh.z. I/System.out: sec data len：100811
2023-01-06 10:59:15.841 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:89
2023-01-06 10:59:15.842 4518-4998/com.gh.z. I/System.out: Cpu Temp：65
2023-01-06 10:59:15.842 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:15.942 4518-4926/com.gh.z. D/SipCall: onCallTsxState:5
2023-01-06 10:59:15.942 4518-4926/com.gh.z. D/PjsipTalkBack: onCallTsxState: prm:
2023-01-06 10:59:16.819 4518-5226/com.gh.z. I/System.out: sec data len：93210
2023-01-06 10:59:16.841 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:88
2023-01-06 10:59:16.842 4518-4998/com.gh.z. I/System.out: Cpu Temp：65
2023-01-06 10:59:16.842 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:17.110 4518-4926/com.gh.z. D/SipCall: onCallTsxState:5
2023-01-06 10:59:17.110 4518-4926/com.gh.z. D/PjsipTalkBack: onCallTsxState: prm:
2023-01-06 10:59:17.598 4518-6155/com.gh.z. D/pjsip-extern_recorder: 10:59:17.597   Master/sound !Buffer size adjusted from 1159 to 952 (eff_cnt=819)
2023-01-06 10:59:17.836 4518-5226/com.gh.z. I/System.out: sec data len：115925
2023-01-06 10:59:17.841 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:87
2023-01-06 10:59:17.842 4518-4998/com.gh.z. I/System.out: Cpu Temp：65
2023-01-06 10:59:17.842 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:18.842 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:86
2023-01-06 10:59:18.843 4518-4998/com.gh.z. I/System.out: Cpu Temp：64
2023-01-06 10:59:18.843 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:18.852 4518-5226/com.gh.z. I/System.out: sec data len：87093
2023-01-06 10:59:19.174 4518-4925/com.gh.z. D/pjsip-ev_thread: 10:59:19.173  pjsua_media.c !Sending video keyframe request via SIP INFO
2023-01-06 10:59:19.175 4518-4925/com.gh.z. D/pjsip-ev_thread: 10:59:19.174   pjsua_call.c  Call 0 sending INFO request..
2023-01-06 10:59:19.179 4518-4925/com.gh.z. D/pjsip-ev_thread: 10:59:19.178   pjsua_core.c  ...TX 799 bytes Request msg INFO/cseq=4208 (tdta0xe0cab064) to UDP 58.112.104.145:5060:
    INFO sip:1611186079963152384@219.137.62.101:41746;transport=tls SIP/2.0
    Via: SIP/2.0/UDP 219.137.62.101:37438;rport;branch=z9hG4bKPjdc6d2d71-3838-4313-90d6-7a1ce0db646d
    Max-Forwards: 70
    From: <sip:1611205501427777536@open.sip.com.>;tag=a4243722-92e6-49e8-a4bf-7b6d2f4c441e
    To: <sip:1611186079963152384@open.sip.com.>;tag=YESLbFyPL
    Call-ID: UzglGh50Q-
    CSeq: 4208 INFO
    Route: <sip:58.112.104.145:5060;lr;r2=on;nat=yes;did=9a1.9d3dd184>
    Route: <sip:58.112.104.145:8061;transport=tls;lr;r2=on;nat=yes;did=9a1.9d3dd184>
    User-Agent: Pjsua2 Android 2.12-dev
    Content-Type: application/media_control+xml
    Content-Length:   146

    <?xml version="1.0" encoding="utf-8" ?><media_control><vc_primitive><to_encoder><picture_fast_update/></to_encoder></vc_primitive></media_control>
    --end msg--
2023-01-06 10:59:19.181 4518-4925/com.gh.z. D/SipCall: onCallTsxState:5
2023-01-06 10:59:19.181 4518-4925/com.gh.z. D/PjsipTalkBack: onCallTsxState: prm:
2023-01-06 10:59:19.248 4518-4926/com.gh.z. D/pjsip-pjsua_0: 10:59:19.246   pjsua_core.c !.RX 444 bytes Response msg 200/INFO/cseq=4208 (rdata0xe12f5014) from UDP 58.112.104.145:5060:
    SIP/2.0 200 Ok
    Via: SIP/2.0/UDP 219.137.62.101:37438;received=219.137.62.101;rport=37438;branch=z9hG4bKPjdc6d2d71-3838-4313-90d6-7a1ce0db646d
    From: <sip:1611205501427777536@open.sip.com.>;tag=a4243722-92e6-49e8-a4bf-7b6d2f4c441e
    To: <sip:1611186079963152384@open.sip.com.>;tag=YESLbFyPL
    Call-ID: UzglGh50Q-
    CSeq: 4208 INFO
    User-Agent: Unknown
    Supported: replaces, outbound, gruu, record-aware
    Content-Length: 0

    --end msg--
2023-01-06 10:59:19.249 4518-4926/com.gh.z. D/SipCall: onCallTsxState:5
2023-01-06 10:59:19.249 4518-4926/com.gh.z. D/PjsipTalkBack: onCallTsxState: prm:SIP/2.0 200 Ok
    Via: SIP/2.0/UDP 219.137.62.101:37438;received=219.137.62.101;rport=37438;branch=z9hG4bKPjdc6d2d71-3838-4313-90d6-7a1ce0db646d
    From: <sip:1611205501427777536@open.sip.com.>;tag=a4243722-92e6-49e8-a4bf-7b6d2f4c441e
    To: <sip:1611186079963152384@open.sip.com.>;tag=YESLbFyPL
    Call-ID: UzglGh50Q-
    CSeq: 4208 INFO
    User-Agent: Unknown
    Supported: replaces, outbound, gruu, record-aware
    Content-Length: 0
2023-01-06 10:59:19.843 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:85
2023-01-06 10:59:19.844 4518-4998/com.gh.z. I/System.out: Cpu Temp：65
2023-01-06 10:59:19.844 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:19.871 4518-5226/com.gh.z. I/System.out: sec data len：115555
2023-01-06 10:59:20.039 4518-4926/com.gh.z. D/SipCall: onCallTsxState:5
2023-01-06 10:59:20.039 4518-4926/com.gh.z. D/PjsipTalkBack: onCallTsxState: prm:
2023-01-06 10:59:20.846 4518-6161/com.gh.z. D/PjsipTalkBack: PjsipTalkBack cloud count down:84
2023-01-06 10:59:20.847 4518-4998/com.gh.z. I/System.out: Cpu Temp：64
2023-01-06 10:59:20.847 4518-4998/com.gh.z. I/System.out:  Event----MCUReceiveEvenet---->cloude phone  this stat：STATUS_WIDTH_APP
2023-01-06 10:59:20.902 4518-5226/com.gh.z. I/System.out: sec data len：96649
2023-01-06 10:59:21.194 30818-32015/system_process I/WindowState: WIN DEATH: Window{147880d u0 com.gh.z./com.gh.z..ui.activity.MainActivity}
2023-01-06 10:59:21.195 30737-3449/? E/OMXNodeInstance: !!! Observer died. Quickly, do something, ... anything...
2023-01-06 10:59:21.197 30818-31415/system_process D/WifiService: Client connection lost with reason: 4
2023-01-06 10:59:21.198 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.198 30818-31865/system_process I/libprocessgroup: Killing pid 4691 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.198 30818-31865/system_process I/libprocessgroup: Killing pid 4813 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.198 30818-31865/system_process I/libprocessgroup: Killing pid 6054 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.198 30818-31073/system_process W/InputDispatcher: channel 'b74bc0 com.gh.z./com.gh.z..ui.activity.MonitoringActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
2023-01-06 10:59:21.198 30818-31073/system_process E/InputDispatcher: channel 'b74bc0 com.gh.z./com.gh.z..ui.activity.MonitoringActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2023-01-06 10:59:21.199 30818-31899/system_process D/GraphicsStats: Buffer count: 4
2023-01-06 10:59:21.200 30737-6140/? D/awplayer: <ComponentThread:2560>: x set state command, cmd = 0, pCmdData = 2.
2023-01-06 10:59:21.202 1623-1623/? I/Zygote: Process 4518 exited due to signal (11)
2023-01-06 10:59:21.203 30737-6158/? D/audio_hw_primary: >>>>>> select_device
    --------- beginning of crash
2023-01-06 10:59:21.205 4704-4704/? A/libc: Fatal signal 13 (SIGPIPE), code 0 in tid 4704 (sh)
2023-01-06 10:59:21.206 30737-6158/? V/audio_hw_primary: active_output, ****LINE:1050,FUNC:select_device, adev->out_device:2
2023-01-06 10:59:21.206 30737-6158/? V/audio_hw_primary: ****LINE:1056,FUNC:select_device, headset_on:0, headphone_on:0, speaker_on:2, earpiece_on:0, bt_on:0
2023-01-06 10:59:21.206 30737-6158/? V/audio_hw_primary: ****LINE:1083,FUNC:select_device, output_device_id:6
2023-01-06 10:59:21.206 30737-6158/? V/audio_hw_primary: NORMAL mode, ****LINE:1087,FUNC:select_device, adev->out_device:2
2023-01-06 10:59:21.211 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.214 30737-31108/? D/V4L2CameraDevice: V4L2CameraDevice::stopDevice
2023-01-06 10:59:21.214 30737-30889/? W/CameraHardware: CMD_QUEUE_STOP_FACE_DETECTE failed, mFaceDetection not opened.
2023-01-06 10:59:21.214 30737-31108/? W/V4L2CameraDevice: wait until capture thread pause or exit
2023-01-06 10:59:21.216 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.218 30818-30838/system_process I/WindowState: WIN DEATH: Window{b74bc0 u0 com.gh.z./com.gh.z..ui.activity.MonitoringActivity}
2023-01-06 10:59:21.218 30818-30838/system_process W/InputDispatcher: Attempted to unregister already unregistered input channel 'b74bc0 com.gh.z./com.gh.z..ui.activity.MonitoringActivity (server)'
2023-01-06 10:59:21.218 30818-30838/system_process W/WindowManager: Force-removing child win Window{8260a4a u0 SurfaceView} from container Window{b74bc0 u0 com.gh.z./com.gh.z..ui.activity.MonitoringActivity}
2023-01-06 10:59:21.222 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.227 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.230 30818-32069/system_process W/WindowManager: Failed looking up window
    java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@d9ff0f9 does not exist
        at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8764)
        at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8755)
        at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1209)
        at android.os.BinderProxy.sendDeathNotice(Binder.java:558)
2023-01-06 10:59:21.230 30818-32069/system_process I/WindowState: WIN DEATH: null
2023-01-06 10:59:21.232 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.238 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.242 30737-30884/? W/V4L2CameraDevice: should stop capture now
2023-01-06 10:59:21.243 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.249 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.254 30818-31865/system_process I/libprocessgroup: Killing pid 4687 in uid 10040 as part of process group 4518
2023-01-06 10:59:21.260 1629-1629/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2023-01-06 10:59:21.260 30818-31865/system_process I/ActivityManager: Process com.gh.z. (pid 4518) has died
2023-01-06 10:59:21.260 1629-1629/? A/DEBUG: Build fingerprint: 'Allwinner/tulip_p2/tulip-p2:6.0.1/MOB30J/20211026:eng/test-keys'
2023-01-06 10:59:21.260 1629-1629/? A/DEBUG: Revision: '0'
2023-01-06 10:59:21.260 1629-1629/? A/DEBUG: ABI: 'arm64'
2023-01-06 10:59:21.260 30818-31865/system_process W/ActivityManager: Scheduling restart of crashed service com.gh.z./org.eclipse.paho.android.service.MqttService in 1000ms
2023-01-06 10:59:21.261 30818-31865/system_process W/ActivityManager: Force removing ActivityRecord{9054b8d u0 com.gh.z./.ui.activity.MonitoringActivity t11}: app died, no saved state
2023-01-06 10:59:21.261 30818-31488/system_process W/NativeCrashListener: Couldn't find ProcessRecord for pid 4704
2023-01-06 10:59:21.262 1629-1629/? A/DEBUG: pid: 4704, tid: 4704, name: sh  >>> sh <<<
2023-01-06 10:59:21.262 1629-1629/? E/DEBUG: AM write failed: Broken pipe
2023-01-06 10:59:21.262 1629-1629/? A/DEBUG: signal 13 (SIGPIPE), code 0 (SI_USER), fault addr --------
2023-01-06 10:59:21.263 1619-1657/? D/Sayeye: current scense is (Normal)
2023-01-06 10:59:21.263 1619-1657/? E/Sayeye: failed to open /sys/devices/soc.0/cpu_budget_cool.17/roomage, No such file or directory
2023-01-06 10:59:21.263 1619-1657/? E/Sayeye: failed to open /sys/devices/soc.0/1c2ac00.twi/i2c-0/0-0040/runtime_suspend, No such file or directory
2023-01-06 10:59:21.263 1619-1657/? D/Sayeye: Scense (Normal) state set succeed
2023-01-06 10:59:21.264 30818-30854/system_process I/DynamicPManagerService: Current Scense:normal
2023-01-06 10:59:21.265 30737-31927/? V/codec_audio_iface: phone_record_enable, line: 165
2023-01-06 10:59:21.265 30737-31927/? D/audio_hw_primary: adev_close_input_stream set voice record status
2023-01-06 10:59:21.268 30737-31735/? V/codec_audio_iface: phone_record_enable, line: 165
2023-01-06 10:59:21.268 30737-31735/? D/audio_hw_primary: adev_close_input_stream set voice record status
2023-01-06 10:59:21.268 1629-1629/? A/DEBUG:     x0   ffffffffffffffe0  x1   0000007f79858000  x2   0000000000000146  x3   0000000000000000
2023-01-06 10:59:21.268 1629-1629/? A/DEBUG:     x4   0000007f79bf3000  x5   0000000000000001  x6   0000000000000000  x7   0000000000000000
2023-01-06 10:59:21.268 1629-1629/? A/DEBUG:     x8   0000000000000040  x9   0000000000000ba0  x10  0000000000000000  x11  0000007f79a02380
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     x12  0000000000000000  x13  0000000000000000  x14  0000000000000001  x15  000000000000005f
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     x16  0000005585c40b50  x17  0000007f79b7828c  x18  0000000000000009  x19  0000000000000061
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     x20  0000000000000146  x21  0000007f79858000  x22  0000007f79d4d0a8  x23  0000000000000019
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     x24  0000000000000000  x25  0000000000000004  x26  0000007f79a31248  x27  0000007f79858000
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     x28  0000007f79a0c200  x29  0000007ffff92ce0  x30  0000005585c0a360
2023-01-06 10:59:21.269 1629-1629/? A/DEBUG:     sp   0000007ffff92ce0  pc   0000007f79b78294  pstate 0000000000000000
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG: backtrace:
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #00 pc 000000000006a294  /system/lib64/libc.so (write+8)
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #01 pc 000000000001f35c  /system/bin/sh (c_cat+216)
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #02 pc 000000000001522c  /system/bin/sh
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #03 pc 0000000000017ba4  /system/bin/sh
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #04 pc 0000000000016edc  /system/bin/sh
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #05 pc 000000000002a2d4  /system/bin/sh
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #06 pc 000000000000629c  /system/bin/sh (main+1848)
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #07 pc 000000000001bc98  /system/lib64/libc.so (__libc_init+100)
2023-01-06 10:59:21.274 1629-1629/? A/DEBUG:     #08 pc 0000000000006860  /system/bin/sh
2023-01-06 10:59:21.280 30818-31865/system_process I/ActivityManager: Start proc 6286:com.gh.z./u0a40 for activity com.gh.z./.ui.activity.MainActivity
2023-01-06 10:59:21.283 6286-6286/? I/art: Late-enabling JIT
2023-01-06 10:59:21.296 30737-6140/? D/awplayer: <ComponentThread:2560>: x set state command, cmd = 0, pCmdData = 1.
2023-01-06 10:59:21.300 6286-6286/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
2023-01-06 10:59:21.307 30737-31103/? E/AudioFlinger: no wake lock to update!
2023-01-06 10:59:21.354 1618-1686/? I/[Gralloc]: ion_alloc from ion_client:19 via heap type DMA(mask:16) for 2457600 Bytes cached buffer successfully, usage = 0x00000933
2023-01-06 10:59:21.363 30737-6154/? D/CallbackNotifier: savePictureThread exit, line: 1515
2023-01-06 10:59:21.365 30737-31108/? I/CameraFlashlight: Destroying camera 0
2023-01-06 10:59:21.387 1629-1629/? A/DEBUG: Tombstone written to: /data/tombstones/tombstone_01
2023-01-06 10:59:21.388 30818-30867/system_process I/BootReceiver: Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
2023-01-06 10:59:21.396 6286-6286/com.gh.z. I/MultiDex: VM with version 2.1.0 has multidex support
2023-01-06 10:59:21.396 6286-6286/com.gh.z. I/MultiDex: Installing application
2023-01-06 10:59:21.397 6286-6286/com.gh.z. I/MultiDex: VM has multidex support, MultiDex support library is disabled.
2023-01-06 10:59:21.397 30737-3449/? D/awplayer: <component_deinit:2055>: component_deinit
2023-01-06 10:59:21.405 30737-6140/? D/awplayer: <ComponentThread:2989>: x stop command.
2023-01-06 10:59:21.405 30737-6141/? D/awplayer: <ComponentVencThread:3895>: vencThread detect nStopFlag[1], exit!
2023-01-06 10:59:21.406 30737-3449/? D/awplayer: <check_lib_unload:394>:  Unloading the dynamic library for OMX.allwinner.video.encoder.avc
2023-01-06 10:59:21.433 6286-6286/com.gh.z. W/ActivityThread: ClassLoader.getResources: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
2023-01-06 10:59:21.467 30737-31108/? D/HALCameraFactory: There is 1 attached cameras and 0 removable cameras
2023-01-06 10:59:21.467 30737-31108/? I/CameraService: disconnect: Disconnected client for camera 0 for PID 4518
2023-01-06 10:59:21.468 30737-31108/? D/NuPlayerDriver: reset(0xf61180a0)
2023-01-06 10:59:21.468 30737-31108/? D/NuPlayerDriver: notifyListener_l(0xf61180a0), (8, 0, 0)
2023-01-06 10:59:21.468 30737-6147/? D/NuPlayerDriver: notifyResetComplete(0xf61180a0)
2023-01-06 10:59:21.469 30737-31108/? D/NuPlayerDriver: reset(0xf61185e0)
2023-01-06 10:59:21.469 30737-31108/? D/NuPlayerDriver: notifyListener_l(0xf61185e0), (8, 0, 0)
2023-01-06 10:59:21.470 30737-6149/? D/NuPlayerDriver: notifyResetComplete(0xf61185e0)
2023-01-06 10:59:21.470 30737-31108/? D/NuPlayerDriver: reset(0xf6118640)
2023-01-06 10:59:21.470 30737-31108/? D/NuPlayerDriver: notifyListener_l(0xf6118640), (8, 0, 0)
2023-01-06 10:59:21.471 30737-6151/? D/NuPlayerDriver: notifyResetComplete(0xf6118640)
2023-01-06 10:59:21.472 30737-31108/? E/CameraService: binderDied: Java client's binder died, removing it from the list of active clients


问:
change loop uses pcntl_fork by fiber in php 8.1
Can someone help me please, to use fiber on a loop like pcntl_fork to process data in parallel,
Here is the code for converting to fiber, Thanks.

```<code>`$names = array('A','B','C','D','E');
$childs = array();

for ($i=0; $i < count($names) ; $i++) {

    $pid = pcntl_fork();
    if($pid == -1)
        die('Could not fork \n');

    if ($pid) {
        //echo 'parent \n';
        $childs[] = $pid;
    } else {
        // Sleep $i+1 (s). The child process can get this parameters($i).
        get_data_function($names[$i]);
        sleep(1);

        // The child process needed to end the loop.
        exit();
    }

}
while(count($childs) > 0) {
    foreach($childs as $key => $pid) {
        $res = pcntl_waitpid($pid, $status, WNOHANG);

        // If the process has already exited
        if($res == -1 || $res > 0)
            unset($childs[$key]);
    }

    sleep(1);
}`
</code>```

I want the function get_data_function() to run in parallel on all names like pcnt_fork
pcnt_fork: make the loop asynchronous
in the end I want to convert the above algorithm which uses pcntl_fork, by the new feature fibers in php8

Notice: the algorithm works very well with pcntl_fork in multithread

Body:
Can someone help me please, to use fiber on a loop like pcntl_fork to process data in parallel,
Here is the code for converting to fiber, Thanks.

`$names = array('A','B','C','D','E');
$childs = array();

for ($i=0; $i < count($names) ; $i++) {

    $pid = pcntl_fork();
    if($pid == -1)
        die('Could not fork \n');

    if ($pid) {
        //echo 'parent \n';
        $childs[] = $pid;
    } else {
        // Sleep $i+1 (s). The child process can get this parameters($i).
        get_data_function($names[$i]);
        sleep(1);

        // The child process needed to end the loop.
        exit();
    }

}
while(count($childs) > 0) {
    foreach($childs as $key => $pid) {
        $res = pcntl_waitpid($pid, $status, WNOHANG);

        // If the process has already exited
        if($res == -1 || $res > 0)
            unset($childs[$key]);
    }

    sleep(1);
}`

I want the function get_data_function() to run in parallel on all names like pcnt_fork
pcnt_fork: make the loop asynchronous
in the end I want to convert the above algorithm which uses pcntl_fork, by the new feature fibers in php8

Notice: the algorithm works very well with pcntl_fork in multithread


问:
How to make a list/string that we need from another list/string that we have using dictionaries with several options?
Perhaps you played DotA, now there is an in-game event going on, this is code that should help in calculating a more profitable "currency" exchange for buying rewards in this event.

The problem is that you need to check the possibility of converting the string HAVE to the string NEED. Two dictionaries can be used for this: trade_limit replaces several letters with several, and trade_perm replaces three letters with one. One replacement occurs, the result is added to the database, from where it will be taken again later, and the characters will be replaced again. I wrote the code, but it just iterates over possible replacements until the replaced equals the target value. Need help to just check the possibility of converting one string to another, and if possible, how it was done step by step.

```<code>from itertools import *
import pandas as pd

#a function to check if there are characters in the source string, in order to change them later
def list_contains(List1, List2):
    lst1, lst2 = list(List1), list(List2)
    if len(lst1) > 0:
        for elem in lst1:
            if elem in lst2:
                lst2.remove(elem)
            else:
                return False
        return True
    else:
        return False

#main function
def dota_candys():
    #source string
    have = sorted(['b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'p', 'p', 'p', 'p', 'p', 'g', 'g', 'g', 'v', 'r', 'r'])
    #string that we needed
    need = sorted(['b', 'p', 'p', 'p', 'g', 'g', 'v', 'v', 'v', 'v', 'v', 'v', 'v', 'v', 'r', 'r'])
    #dictionarys to replace symbols
    #several symbols with several
    trade_limit = {
    ('r', 'r'):['b', 'b'],
    ('p', 'r', 'r'):['g', 'g', 'v'],
    ('g', 'p'):['r', 'r', 'r'],
    ('g', 'g'):['r', 'r']}
    #three symbols with one of the four remaining
    trade_perm = {
    ('b', 'b', 'b'):['p', 'g', 'v', 'r'],
    ('p', 'p', 'p'):['b', 'g', 'v', 'r'],
    ('g', 'g', 'g'):['p', 'b', 'v', 'r'],
    ('v', 'v', 'v'):['p', 'g', 'b', 'r'],
    ('r', 'r', 'r'):['p', 'g', 'v', 'b']}
    #making lists to strings
    new_have = ''.join(sorted(have))
    new_need = ''.join(sorted(need))
    #creating DB
    res_candys = pd.DataFrame({'have':[new_have]}, index=[0])
    c=1
    #cycle that will stop if we get string that we needed
    while ''.join(sorted(have)) != new_need:
        for have in res_candys.have.unique():
            c+=1
            #function will stop when it will be done 1mil times
            if c == 1000000:
                print(len(res_candys.have.unique()))
                return 0
            if c % 1000 == 0:
                print(c)
            if have == new_need:
                print('!!!')
                return 0
            new_have = have
            new_have1 = have
            #cycles for each in each for two dictionarys
            for k_l in trade_limit.keys():
                for k_p in trade_perm.keys():
                    #replace several letters with several
                    #that function was above, to check possibilities of replacement
                    if list_contains(k_l, have):
                        for symbol in k_l:
                            new_have = new_have.replace(symbol, '', 1)
                        for symbol in trade_limit[k_l]:
                            new_have += symbol
                            new_have = ''.join(sorted(new_have))
                        #max lenght of string, that we have, less than 20
                        if len(new_have) > 20:
                            continue
                        #add to DB
                        add_row = pd.Series({'have':new_have})
                        res_candys = pd.concat([res_candys, add_row.to_frame().T], ignore_index=True)
                    #replace 3 letters with one
                    #that function was above, to check possibilities of replacement
                    if list_contains(k_p, have):
                        for symbol in k_p:
                            new_have1 = new_have1.replace(symbol, '', 1)
                        list(new_have1).append(trade_perm[k_p])
                        #making all replaces (we can change we can change three letters to one of the four remaining)
                        for last_have in product(*list(new_have1)):
                            #max lenght of string, that we have, less than 20
                            if len(last_have) > 20:
                                continue
                            #add to DB
                            last_have = ''.join(sorted(last_have))
                            add_row = pd.Series({'have':last_have})
                            res_candys = pd.concat([res_candys, add_row.to_frame().T], ignore_index=True)

#calling function
dota_candys()
</code>```

Over time, it starts to work worse, help is needed with this too.

In this version of the code, a string is edited, earlier I tried to do it through lists, but the results were worse. The SET class option is not suitable because some letters are repeated.

Body:
Perhaps you played DotA, now there is an in-game event going on, this is code that should help in calculating a more profitable "currency" exchange for buying rewards in this event.

The problem is that you need to check the possibility of converting the string HAVE to the string NEED. Two dictionaries can be used for this: trade_limit replaces several letters with several, and trade_perm replaces three letters with one. One replacement occurs, the result is added to the database, from where it will be taken again later, and the characters will be replaced again. I wrote the code, but it just iterates over possible replacements until the replaced equals the target value. Need help to just check the possibility of converting one string to another, and if possible, how it was done step by step.

from itertools import *
import pandas as pd

#a function to check if there are characters in the source string, in order to change them later
def list_contains(List1, List2):
    lst1, lst2 = list(List1), list(List2)
    if len(lst1) > 0:
        for elem in lst1:
            if elem in lst2:
                lst2.remove(elem)
            else:
                return False
        return True
    else:
        return False

#main function
def dota_candys():
    #source string
    have = sorted(['b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'p', 'p', 'p', 'p', 'p', 'g', 'g', 'g', 'v', 'r', 'r'])
    #string that we needed
    need = sorted(['b', 'p', 'p', 'p', 'g', 'g', 'v', 'v', 'v', 'v', 'v', 'v', 'v', 'v', 'r', 'r'])
    #dictionarys to replace symbols
    #several symbols with several
    trade_limit = {
    ('r', 'r'):['b', 'b'],
    ('p', 'r', 'r'):['g', 'g', 'v'],
    ('g', 'p'):['r', 'r', 'r'],
    ('g', 'g'):['r', 'r']}
    #three symbols with one of the four remaining
    trade_perm = {
    ('b', 'b', 'b'):['p', 'g', 'v', 'r'],
    ('p', 'p', 'p'):['b', 'g', 'v', 'r'],
    ('g', 'g', 'g'):['p', 'b', 'v', 'r'],
    ('v', 'v', 'v'):['p', 'g', 'b', 'r'],
    ('r', 'r', 'r'):['p', 'g', 'v', 'b']}
    #making lists to strings
    new_have = ''.join(sorted(have))
    new_need = ''.join(sorted(need))
    #creating DB
    res_candys = pd.DataFrame({'have':[new_have]}, index=[0])
    c=1
    #cycle that will stop if we get string that we needed
    while ''.join(sorted(have)) != new_need:
        for have in res_candys.have.unique():
            c+=1
            #function will stop when it will be done 1mil times
            if c == 1000000:
                print(len(res_candys.have.unique()))
                return 0
            if c % 1000 == 0:
                print(c)
            if have == new_need:
                print('!!!')
                return 0
            new_have = have
            new_have1 = have
            #cycles for each in each for two dictionarys
            for k_l in trade_limit.keys():
                for k_p in trade_perm.keys():
                    #replace several letters with several
                    #that function was above, to check possibilities of replacement
                    if list_contains(k_l, have):
                        for symbol in k_l:
                            new_have = new_have.replace(symbol, '', 1)
                        for symbol in trade_limit[k_l]:
                            new_have += symbol
                            new_have = ''.join(sorted(new_have))
                        #max lenght of string, that we have, less than 20
                        if len(new_have) > 20:
                            continue
                        #add to DB
                        add_row = pd.Series({'have':new_have})
                        res_candys = pd.concat([res_candys, add_row.to_frame().T], ignore_index=True)
                    #replace 3 letters with one
                    #that function was above, to check possibilities of replacement
                    if list_contains(k_p, have):
                        for symbol in k_p:
                            new_have1 = new_have1.replace(symbol, '', 1)
                        list(new_have1).append(trade_perm[k_p])
                        #making all replaces (we can change we can change three letters to one of the four remaining)
                        for last_have in product(*list(new_have1)):
                            #max lenght of string, that we have, less than 20
                            if len(last_have) > 20:
                                continue
                            #add to DB
                            last_have = ''.join(sorted(last_have))
                            add_row = pd.Series({'have':last_have})
                            res_candys = pd.concat([res_candys, add_row.to_frame().T], ignore_index=True)

#calling function
dota_candys()

Over time, it starts to work worse, help is needed with this too.

In this version of the code, a string is edited, earlier I tried to do it through lists, but the results were worse. The SET class option is not suitable because some letters are repeated.


问:
uploading files to ejabberd server
I want to upload files to ejabberd server using postman. I am getting this error Not found.

I am using this request to upload files using postman

This is my ejabber.yml

hosts:
  - localhost

loglevel: debug

  -
    port: 5443
    module: ejabberd_http
    request_handlers:
      /upload: mod_http_upload

modules:
  mod_admin_extra: {}
  mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
    access_mam:
      - allow
    default_room_options:
      allow_subscription: true  # enable MucSub
      allow_private_messages: true
      allow_user_invites: true
      mam: true
      persistent: true
  mod_muc_admin: {}
  mod_push_keepalive:
    wake_on_start: true
  mod_offline: {}
  mod_push: {}
  mod_http_upload:
    put_url: http://@HOST@:5443/upload
    docroot: /home/ejabberd/upload
  mod_roster: {}

  #mod_offline_notify: {}

    ```

I am using ejabberd v22.10 with Windows 10.
How can I send an upload request using postman?
I did not find any documentation for this

Title: uploading files to ejabberd server

Body:
I want to upload files to ejabberd server using postman. I am getting this error Not found.

I am using this request to upload files using postman

This is my ejabber.yml

hosts:
  - localhost

loglevel: debug

  -
    port: 5443
    module: ejabberd_http
    request_handlers:
      /upload: mod_http_upload

modules:
  mod_admin_extra: {}
  mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
    access_mam:
      - allow
    default_room_options:
      allow_subscription: true  # enable MucSub
      allow_private_messages: true
      allow_user_invites: true
      mam: true
      persistent: true
  mod_muc_admin: {}
  mod_push_keepalive:
    wake_on_start: true
  mod_offline: {}
  mod_push: {}
  mod_http_upload:
    put_url: http://@HOST@:5443/upload
    docroot: /home/ejabberd/upload
  mod_roster: {}

  #mod_offline_notify: {}

I am using ejabberd v22.10 with Windows 10.
How can I send an upload request using postman?
I did not find any documentation for this


问:
Timeout on task cancellation
Consider this code:

import asyncio
from async_timeout import timeout

async def sleep_coroutine(sleep=10):
    while True:
        print("Coroutine running")
        try:
            await asyncio.sleep(10)
        except Exception:
            print("Ignoring exception")

async def main():
    task = asyncio.get_event_loop().create_task(sleep_coroutine())
    await asyncio.sleep(2)

    print("Cancelling")
    task.cancel()

    with timeout(3) as cancel_timeout:
        await task

    if cancel_timeout.expired:
        print("Timed out !")

    print("Finally done !")

if __name__ == "__main__":
    asyncio.get_event_loop().run_until_complete(main())
```

There is clearly an issue in this code, making task cancellation impossible. When task.cancel() is called, sleep_coroutine catches the CancelledError as any other Exception. So it ignores it and await task becomes infinite.

The broad except should be removed, or at least asyncio.CancelledError should be caught and re-raised before. But let's say I don't have hands on this code.

Is there a way to put a timeout on the task cancellation ? Something like "Wait for cancellation for 3 seconds with a timeout. And if timed out, 'force cancel' it".

Using async_timeout here doesn't help since it uses the same task cancellation internally.

Title: Timeout on task cancellation

Body:
Consider this code:

import asyncio
from async_timeout import timeout

async def sleep_coroutine(sleep=10):
    while True:
        print("Coroutine running")
        try:
            await asyncio.sleep(10)
        except Exception:
            print("Ignoring exception")

async def main():
    task = asyncio.get_event_loop().create_task(sleep_coroutine())
    await asyncio.sleep(2)

    print("Cancelling")
    task.cancel()

    with timeout(3) as cancel_timeout:
        await task

    if cancel_timeout.expired:
        print("Timed out !")

    print("Finally done !")

if __name__ == "__main__":
    asyncio.get_event_loop().run_until_complete(main())

There is clearly an issue in this code, making task cancellation impossible. When task.cancel() is called, sleep_coroutine catches the CancelledError as any other Exception. So it ignores it and await task becomes infinite.

The broad except should be removed, or at least asyncio.CancelledError should be caught and re-raised before. But let's say I don't have hands on this code.

Is there a way to put a timeout on the task cancellation ? Something like "Wait for cancellation for 3 seconds with a timeout. And if timed out, 'force cancel' it".

Using async_timeout here doesn't help since it uses the same task cancellation internally.


问:
Laravel Goutte Crawler timeout not works with "Too many redirects"
I am doing parsing remote websites with Laravel Goutte, and if remote website have error "Too many redirects" (I see it in Google Chrome), crawler just freeze and nothing happend.

```<code>use Goutte\Client;
use Symfony\Component\HttpClient\HttpClient;

 try {
     $client = new Client(HttpClient::create(['timeout' => 5, 'max_redirects' => 1]));
     $client->request('GET', 'https://' . $domain_name);
}catch (\Exception $e){
     $this->error($e->getMessage());
}
</code>```

I expect that if website will be not reached in 5 sec query will be droped and error will be catched, but for a very long time nothing happend (it just freeze on request row).
How I can handle websites with "Too many redirects" errors?

p.s. I don't know if I can post domain(tried with many domains that give this error) where I do query, if yes, I can post it in comments.

Body:
I am doing parsing remote websites with Laravel Goutte, and if remote website have error "Too many redirects" (I see it in Google Chrome), crawler just freeze and nothing happend.

use Goutte\Client;
use Symfony\Component\HttpClient\HttpClient;

 try {
     $client = new Client(HttpClient::create(['timeout' => 5, 'max_redirects' => 1]));
     $client->request('GET', 'https://' . $domain_name);
}catch (\Exception $e){
     $this->error($e->getMessage());
}

I expect that if website will be not reached in 5 sec query will be droped and error will be catched, but for a very long time nothing happend (it just freeze on request row).
How I can handle websites with "Too many redirects" errors?

p.s. I don't know if I can post domain(tried with many domains that give this error) where I do query, if yes, I can post it in comments.