Runtime error 3221226356

The CGO module gorfc provides GO bindings to pre-compiled SAP NWRFC SDK binaries. The module works fine on Linux and macOS and never worked quite stable on Windows. Currently, it occasionally termi...

The CGO module gorfc provides GO bindings to pre-compiled SAP NWRFC SDK binaries. The module works fine on Linux and macOS and never worked quite stable on Windows. Currently, it occasionally terminates on Windows, with heap corruption error 3221226356 (hex C0000374).

I am not sure if the toolchain and compiler flags are maybe part of the problem, here further details.

Toolchain

SAP NWRFC SDK binaries require Microsoft C Runtime DLLs version 12.0 and our Windows toolchain is based on MinGW64, with following settings:

Version: 8.1.0
Architecture: x86_64
Threads: win32
Exception: seh
Build revision: 0

The TDM GCC is not used because this issue still occurs: error adding symbols: File in wrong format

Is this the optimal toolchain for building CGO modules on Windows, or another approach could be considered?

Compiler flags

Compiler flags recommended for SAP NWRFC SDK bindings on Windows platform, are given for Windows native compiler and linker:

cl.exe -DSAPonNT -D_CRT_NON_CONFORMING_SWPRINTFS -D_CRT_SECURE_NO_DEPRECATE 
-D_CRT_NONSTDC_NO_DEPRECATE -D_AFXDLL -DWIN32 -D_WIN32_WINNT=0x0502 -DWIN64 
-D_AMD64_ -DNDEBUG -DSAPwithUNICODE -DUNICODE -D_UNICODE -DSAPwithTHREADS 
-Inwrfcsdk/include -EHs -Gy -J -MD -nologo -W3 -Z7 -D_ATL_ALLOW_CHAR_UNSIGNED -GL 
-O2 -Oy- /we4552 /we4700 /we4789 -c -FosflightClient.obj sflightClient.c

link.exe -OUT:sflightClient.exe -PDB:sflightClient.pdb -NXCOMPAT -STACK:0x2000000 
-SWAPRUN:NET -DEBUG -OPT:REF -DEBUGTYPE:CV,FIXUP -MACHINE:amd64 -nologo 
-LTCG  ole32.lib oleaut32.lib uuid.lib kernel32.lib advapi32.lib user32.lib gdi32.lib winspool.lib ws2_32.lib comdlg32.lib shell32.lib sflightClient.obj nwrfcsdk/lib/sapnwrfc.lib nwrfcsdk/lib/libsapucum.lib

GCC counterparts are currently missing for some of them, commented in gorfc source)

Any help/ideas on toolchain, flags, possible root causes and troubleshooting approach, would be of a great help.

Here the details about GO environment on Windows.

PS C:srcGOsrcgithub.comsapgorfc>go version
go version go1.14 windows/amd64

PS C:srcGOsrcgithub.comsapgorfc> go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:Usersd037732AppDataLocalgo-build
set GOENV=C:Usersd037732AppDataRoaminggoenv
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=c:srcGO
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:ToolsGOLANG
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:ToolsGOLANGpkgtoolwindows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:srcGOsrcgithub.comsapgorfcgo.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:Usersd037732AppDataLocalTempgo-build050373882=/tmp/go-build -gno-record-gcc-switches

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
int search(int *arr, int begin, int end, int key) // analog funkcii naxojdenia. Kak argument prinimayet int massiv
{
    int t, res;
    res = -1;
    for(t = begin; t < end; t++)
    {
        if(arr[t] == -1)
            return -1;
        
        if(arr[t] == key)
            {
                res = t;
                break;
            }
    }
    return res;
}
 
void push_back(int **M, int M_size, int **N, int N_size) // adds array N to back of array M
{
    int i;
    *M = (int*) realloc(*M, (M_size+N_size) * sizeof(int));
    for(i = 0; i < N_size; i++)
    {
        *(*M + M_size + i) = *(*N + i);
    }
    
    return;
}
 
 
void dfs(char *table, int t_heig, int t_wid, int column, int *result, int *arr)
{
    int i, k, old_size;
    if(column < 0)
        return;
    
 
    if(column >= t_wid)
    {
    //    printf("inserting result to result-tablen");
    //    printf("value result[0] changed from %d to %dn", result[0], result[0] + ((int)arr[0]+1));
    //    printf("sizeofresult: %dn", result[0]);
    //    printf("memory reallocatedn");
    //    printf("value result[%d] changed from %d to %dn", result[0] - arr[0], result[result[0] - arr[0]], arr[0]);
        push_back(&result, result[0]+1, &arr, arr[0]+1);  // +1, potomu chto 0-element massiva xranit kolvo elementov posle nego
    //  printf("value result[0] changed from %d to %dn", result[0], result[0] + (arr[0]+1));
        result[0] = result[0] + arr[0] + 1;
    //    printf("all elements of arr copied to resultn");
        return;
    }
    printf("column: %dn", column);
    for(i = 0; i < t_heig; i++)
    {
        if(table[i*t_wid + column] == 1)
        {
            if(search(arr, 1, arr[0]+1, i) == -1)
            {
                printf("step: %d; column: %dn", i, column);
                old_size = arr[0];
                arr[0] += 1;
                arr = (int*)realloc(arr, sizeof(int) * (arr[0] + 1));  //  +1 potomu chto 0-element xranit dlinu massiva
                arr[arr[0]] = i;
                dfs(table, t_heig, t_wid, column+1, result, arr);
                arr[0] = old_size;  
            }
            else
            {
                printf("Jump on step: %d; column: %dn", i, column);
                dfs(table, t_heig, t_wid, column+1, result, arr);
                printf("returned on step: %d; column: %dn", i, column);
            }
        }
    }
    
    return;
}
 
void perebor(char *table, int t_heig, int t_wid, int *result)
{
    int *arr;  /* массив для хранения результатов одного прохода рекурсии
                   Этот массив будет скопирован как строку в "таблицу" result*/ 
    result = (int*)realloc(result, sizeof(int));
    result[0] = 0;  /* размер первой строки "таблицы" результатов. 
                        Далее первая ячейка строки будет хранить размер строки.
                        Это мне показалось удобным при работе с ней*/
    arr = (int*)malloc(sizeof(int));
    arr[0] = 0;  // тоже хранит размер массива
    
    dfs(table, t_heig, t_wid, 0, result, arr);
    return;
}

Я начал писать простой класс для работы с матрицами, один конструктор заполняет матрицу одним числом, а другой принимает в качестве аргумента 2d массив.

    #include <iostream>

using namespace std;
int i,j;
class Matrica
{
public:
Matrica(int, int, double);
Matrica(int, int, double*);
~Matrica();
void saberi(Matrica, Matrica);
void read();
void print();
private:
int n,m;
double* matrix;
};

Matrica::Matrica(int a, int b, double broj)
{
n = a;
m = b;
matrix = new double[n*m];
for(i=0;i<n;i++) {
for(j=0;j<m;j++) {
matrix[i*n + j] = broj;
}
}
}

Matrica::Matrica(int a, int b, double* matr)
{
n = a;
m = b;
matrix = new double[n*m];
for(i=0;i<n;i++) {
for(j=0;j<m;j++) {
matrix[i*n + j] = matr[i*n +j];
}
}

}
Matrica::~Matrica() {
delete[] matrix;
}

void Matrica::read() {
double e;
for(i=0;i<n;i++) {
for(j=0;j<m;j++) {
cout<< "insert element ["<<i<<"]["<<j<<"] :" <<endl;
cin >> e;
matrix[n*i +j] = e;
cout<< endl;
}
}
}

void Matrica::print() {
for(i=0;i<n;i++) {
for(j=0;j<m;j++) {
cout << matrix[n*i + j] << " ";
}
cout << endl;
}
}
void Matrica::saberi(Matrica A, Matrica B) {
cout << "foo";
}

int main()
{

Matrica A(3,3,1);
double K[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
Matrica B(3,3,&K[0][0]);
Matrica C(3,3,7);
C.saberi(A,B);
return 0;
}

Моя программа работала нормально, прежде чем я добавил пустой метод «saberi», который принимает два объекта в качестве аргументов. Если я это называю, моя программа падает с возвращаемым значением 3221226356. Что может быть не так? Заранее спасибо.

1

Решение

Как вы определили свою функцию подписи

void saberi(Matrica, Matrica);

Matrica объекты передаются по значению, но вы не предоставили правильный конструктор копирования для класса Matrica,

Самый простой способ решить вашу текущую проблему, это передать параметры по ссылке

void saberi(Matrica&, Matrica&);

или же

void saberi(const Matrica&, const Matrica&);

Во всяком случае, в долгосрочной перспективе вы должны либо предоставить правильный конструктор копирования

Matrica(const Matrica&);

или Fobid его (просто поместите объявление в private секция класса).

1

Другие решения

See more:

I am compiling one sample code. But I am getting the answer when I am compiling that code for input = 5, If I change input from 5 to 6., then once answer came, but next time for same input, throwing a message «return value 3221226356». If again I change the input from 6 to 8, then again that message is coming.

#include <iostream>
#include <string>
#include <cmath>

void loop1(float *a, int &k )                                
{
    int i = k / 2 ;                                          
    for (int x = 0 ; x < i ; x++ )                           
    {
        a[x] = x ;                                           
        std::cout<<"a = "<< a[x] <<'n' ;                    
    }
}

void loop2(float *a, int &i, int &j )                        
{
    for (int x = i ; x < j ; x++ )                           
    {
        a[x] = a[x-i] ;                                      
        std::cout<<"a ["<<x<<"]= "<< a[x] <<'n' ;           
    }
}
void loop3(float *a, int &i)
{
    for (int x = 0 ; x < i ; x++ )
    {
        a[x] = x * x * x ;
        a[x] += a[x];

    }
}

int main()                                                   
{
    int nx ;                                                 
    float* xpos = NULL;                                      
    xpos = new float[nx];                                    

    std::cout<<"enter the value for nx " ;                   
    std::cin>>nx ;                                           
    int a = nx/2 ;                                           
    std::cout<<"a (= nx/2 )= "<< a <<'n' ;                  


    loop1(xpos, nx );                                        
    loop2(xpos, a, nx);                                      

    for (int x = 0 ; x < nx ; x++ )                          
    {
        std::cout<<"xpos = "<< xpos[x] <<'n' ;              
    }


    for (int x = 0 ; x < nx ; x++ )                          
    {
        std::cout<<"new  xpos = "<< xpos[x] <<'n' ;         
    }
    return 0 ;
}

Result for Input = 5

enter the value for nx 5
a (= nx/2 )= 2
a = 0
a = 1
a [2]= 0
a [3]= 1
a [4]= 0
xpos = 0
xpos = 1
xpos = 0
xpos = 1
xpos = 0
new  xpos = 0
new  xpos = 1
new  xpos = 0
new  xpos = 1
new  xpos = 0

--------------------------------
Process exited after 4.442 seconds with return value 0
Press any key to continue . . .

Result for Input = 6

enter the value for nx 6
a (= nx/2 )= 3
a = 0
a = 1
a = 2
a [3]= 0
a [4]= 1
a [5]= 2
xpos = 0
xpos = 1
xpos = 2
xpos = 0
xpos = 1
xpos = 2
new  xpos = 0
new  xpos = 1
new  xpos = 2
new  xpos = 0
new  xpos = 1
new  xpos = 2

--------------------------------
Process exited after 3.427 seconds with return value 0
Press any key to continue . . .

Result for Input = 8

<pre lang="c++">enter the value for nx 8
a (= nx/2 )= 4
a = 0
a = 1
a = 2
a = 3
a [4]= 0
a [5]= 1
a [6]=
--------------------------------
Process exited after 7.167 seconds with return value 3221226356
Press any key to continue . . .

Have you got any idea about what I did wrong ?
Is there any specific name of such error?
But, I can’t find why that failed.

What I have tried:

I tried to vary the Input from one to other. But giving the message.

Updated 13-Nov-18 23:53pm


int nx ;                                                 
float* xpos = NULL;                                      
xpos = new float[nx];                                    

You have not set a value for nx, so your array may be any size between -2,147,483,647 and +2,147,483,647.

And remove those backslashes everywhere, what do you think they are for?

Look at your code:

int main()                                                   
{
    int nx ;                                                 
    float* xpos = NULL;                                      
    xpos = new float[nx];   

How many floats are allocated in the array? Since you don’t set a value for nx it will (if you are lucky, it depends on the compiler and the settings you gave it) default to zero.

And since it’s a local variable, the array is on the stack. When you use it, you access parts of the stack that aren’t a part of your array at all, and you corrupt them when you write to the array. At that point, anything can happen!

Allocate some suitable size to the array, or allocate the array once you know how many elements it needs to have!

To fix the obvious in your code

#include <iostream>

void loop1(float a[], size_t k )
{
    size_t limit = k / 2 ;
    for (size_t x = 0 ; x < limit ; x++ )
    {
        a[x] = x ;
        std::cout << "a = " << a[x] << 'n' ;
    }
}

void loop2(float a[], size_t i, size_t j )
{
    for (size_t x = i ; x < j ; x++ )
    {
        a[x] = a[x-i] ;
        std::cout<<"a ["<<x<<"]= "<< a[x] <<'n' ;
    }
}
void loop3(float a[], size_t i)
{
    for (size_t x = 0 ; x < i ; x++ )
    {
        a[x] = x * x * x ;
        a[x] += a[x];
    }
}

int main()
{
    int nx ;
    float* xpos = NULL;

    std::cout<<"enter the value for nx " ;
    std::cin>>nx ;

    xpos = new float[nx];

    int a = nx/2 ;
    std::cout<<"a (= nx/2 )= "<< a <<'n' ;

    loop1(xpos, nx );
    loop2(xpos, a, nx);

    for (int x = 0 ; x < nx ; x++ )
    {
        std::cout<<"xpos = "<< xpos[x] <<'n' ;
    }


    for (int x = 0 ; x < nx ; x++ )
    {
        std::cout<<"new  xpos = "<< xpos[x] <<'n' ;
    }
    delete [] xpos;
}

You should give meaningful names to your functions.
You could use std::vector instead of dynamically allocate yourself the array.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

#c #gcc #malloc #free

#c #gcc #malloc #Бесплатно

Вопрос:

Я изучаю C и решаю некоторые проблемы с кодированием.
При выполнении 1 задачи мне нужно создать динамический 2D-массив символов.

Я пытаюсь следовать некоторым другим ответам StackOverflow, чтобы динамически создавать 2D-массив.

Я могу создать его, но при попытке освободить память я получаю сообщение об ошибке 3221226356.
Ниже приведен мой код:

     #include <stdio.h>
    #include <stdlib.h>

    int main(int argc, char *argv[])
    {
        int n;
        scanf("%d", amp;n);

        char **s = malloc(n * sizeof(char *));

        for (int i = 0; i < n; i  )
        {
            s[i] = malloc(1000 * sizeof(char));
            //memset(s[i], '', 1000);
            scanf("%s", amp;s[i]);
        }

        for (int i = 0; i < n; i  )
        {
            printf("%s - %dn", amp;s[i], strlen(amp;s[i]));
        }

        for (int i = 0; i < n; i  )
        {
            printf("Freeing %dn", i);
            //char *tmp = amp;s[i];
            free(s[i]);
        }

        printf("Freeing sn");

        free(s);

        if (argc > 1)
        {
            char xx[100];
            scanf("%s", xx);
        }
        return EXIT_SUCCESS;
    }
 

И пример запуска кода с выводом:

 2
xx
sss
xx - 2
sss - 3
Freeing 0

[process exited with code 3221226356]
 

Я пытался вызвать free на amp;s[i], а также *s[i], но оба приводят к ошибке.
Мой компилятор — GCC.

Что я делаю не так?

Комментарии:

1. Ваши malloc free вызовы and выглядят нормально, но вы искажаете указатели на строки, scanf вводя amp;s[i] вместо s[i] . ( %s Формат и его двоюродный %[ брат принимают для заполнения строки, которые уже переданы как указатели. Также: пожалуйста, активируйте предупреждения с -Wall помощью . Они покажут вам несоответствия формата.)

2. Все ваши amp;s[i] должны быть просто s[i] . amp;s[i] имеет тип char ** , поэтому не может использоваться с scanf , printf , s[i] и т.д. имеет тип char * , который вам нужен. Ваш компилятор должен был предупредить об этих ошибках. На практике указатели будут иметь одинаковое значение, так что это будет «работать», но это неправильно.

3. М. Оем прав, хотя, если вы хотите сохранить свою строку с определенным индексом , вы могли бы использовать scanf('%s",amp;s[i][index] , scanf("%s",s[i]) равнозначно scanf("%s",amp;s[i][0] .

4. Примечание: 3221226356 равно 0xC000 0374.

5. Лучший первый шаг — включить; все предупреждения компилятора. Хороший компилятор предупредит scanf("%s", amp;s[i]); ... printf("%s - %dn", amp;s[i], strlen(amp;s[i])); и ускорит ваше программирование.

Ответ №1:

Итак, отзывы о amp; s [i] привели меня к своего рода очевидному решению.
Чтобы создать временную переменную для scanf.

 #include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int n;
    scanf("%d", amp;n);

    char **s = malloc(n * sizeof(char *));

    for (int i = 0; i < n; i  )
    {
        //s[i] = malloc(1000 * sizeof(char));
        char *tmp = malloc(sizeof(char));
        //memset(s[i], '', 1000);
        scanf("%s", tmp);
        s[i] = tmp;
    }

    for (int i = 0; i < n; i  )
    {
        printf("%s - %dn", s[i], strlen(s[i]));
    }

    for (int i = 0; i < n; i  )
    {
        printf("Freeing %dn", i);
        //char *tmp = amp;s[i];
        free(s[i]);
    }

    printf("Freeing sn");

    free(s);

    if (argc > 1)
    {
        char xx[100];
        scanf("%s", xx);
    }
    return EXIT_SUCCESS;
}
 

Я делаю змеиную игру в консоли, но всякий раз, когда я пишу system («cls») в функции рисования, она пишет «Процесс завершен с возвращаемым значением 3221226356» на экране вывода. Я думаю, что есть некоторая утечка памяти, но я не мог найти точную причину, почему это происходит.

Вы также можете увидеть этот код по адресу: https://github.com/Lakshay-Dhingra/Snake- Игра

Вот мой код: // Скомпилировано в Dev-C ++ (Windows) с компилятором mingw std-c ++ 11

#include<iostream>
#include<conio.h>
#include <unistd.h>
#include<cstdlib>
using namespace std;

class Node
{
    int x;
    int y;
    Node *link;

    public:
    Node(int ix,int iy)
    {
        x=ix;
        y=iy;
        link=nullptr;
    }

    int getx()
    {
        return x;
    }
    void setx(int x)
    {
        this->x=x;
    }
    int gety()
    {
        return y;
    }
    void sety(int y)
    {
        this->y=y;
    }

    Node* getLink()
    {
        return link;
    }
    void setLink(Node* x)
    {
        link=x;
    }
};

class LL
{
    public:
    Node* head;
    LL()
    {
        head=nullptr;
    }

    void insert(int x,int y)
    {
        Node* mynode=new Node(x,y);
        Node* temp=head;
        head=mynode;
        head->setLink(temp);
    }

//  For Debugging:
//  void showList()
//  {
//      Node* cur=head;
//      while(cur->getLink()!=nullptr)
//      {
//          cout<<cur->getx()<<" "<<cur->gety()<<" --> ";
//          cur=cur->getLink();
//      }
//      cout<<cur->getx()<<" "<<cur->gety()<<endl;
//  }

    int* show(int l)
    {

        int* arr=new int(2*l);
        int i=0;
        Node* cur=head;
        while(cur!=nullptr)
        {
            arr[i]=cur->getx();
            arr[i+1]=cur->gety();
            i+=2;
            cur=cur->getLink();
        }
        return arr;
    }

    ~LL()
    {
        Node* temp=head;
        while(head!=nullptr)
        {
            temp=head->getLink();
            delete head;
            head=temp;
        }
    }
};

class Snake
{
    int length;
    LL* mysnake;

    public:
    Snake(int l,int x,int y)
    {
        mysnake=new LL();
        for(int i=0;i<l;i++)
        {
            mysnake->insert((x+i),y);
        }
        length=l;
    }

    int getLength()
    {
        return length;
    }

    void eatFood(int x,int y)
    {
        length+=1;
        mysnake->insert(x,y);
    }

    int* showSnake()
    {
        return mysnake->show(length);
    }

    int getHeadX()
    {
        return mysnake->head->getx();
    }
    int getHeadY()
    {
        return mysnake->head->gety();
    }
};

class Window
{
    int length;
    int hieght;
    Snake* snk;
    int* arr;

    public:
    Window(int l,int h,int posx,int posy)
    {

        length=l;
        hieght=h;
        snk=new Snake(4,posx-3,posy);
        arr=snk->showSnake();

//      rungame();
//      For Debugging:
//      for(int i=0;i<2*(sk.getLength());i++)
//      {
//          cout<<arr[i]<<" ";
//      }
    }

    void rungame()
    {
        char ch;
        while(true)
        {
            if(kbhit())
            {
            ch = _getch();
            if(int(ch)==27)
                break;
            }
            draw();
        }
    }

    void draw()
    {
        system("cls");
//      arr=snk->showSnake();
//      cout<<"world ";
        bool flag;
        for(int i=0;i<length;i++)
        {
            for(int j=0;j<hieght;j++)
            {
                flag=0;
                if(i==0||i==length-1||j==0||j==hieght-1)
                {
                    cout<<"#";
                    flag=1;
                }
                else
                {
                    for(int k=0;k<snk->getLength();k++)
                    {
                        if(i==arr[2*k]&&j==arr[2*k+1])
                        {
                            cout<<"O";
                            flag=1;
                        }
                    }
                }

                if(flag==0)
                {
                    cout<<" ";
                }
            }
            cout<<endl;
        }
//      For Debugging:
//      for(int k=0;k<snk->getLength();k++)
//          cout<<arr[2*k]<<" "<<arr[2*k+1]<<" ";
        usleep(100000);
    }
};

int main()
{
    Window win(30,50,15,25);
    win.rungame();
    return 0;
}

2 ответа

Лучший ответ

Ошибка 3221226356 — это 0xc0000374 в шестнадцатеричном формате, то есть STATUS_HEAP_CORRUPTION.

Я пропустил его при первом прочтении, но оно вызвано вашим выделением в show():

int* arr=new int(2*l);

Это выделяет пробелы для single int и заполняет его значением 2*l. Впоследствии вы пишете в нераспределенную / неинициализированную память: arr[1], arr[2] и т. Д.

Немедленное исправление просто:

int* arr = new int[2*l];

Это выделяет пространство для 2*l int значений.

В долгосрочной перспективе вам лучше вместо этого использовать std::vector<int> или отказаться от всей этой работы с массивами и обходить свой связанный список напрямую, когда вам нужно (например, в вашей функции draw).


0

Botje
30 Янв 2020 в 09:57

unistd.h — заголовок UNIX (Linux, MacOS и т. Д.), Его не следует включать в проект Windows. Это может быть причиной.

Вызов system("clear"); в Linux SO.

Затем вам нужно заменить функции, такие как usleep(), которые принадлежат unistd.h и не могут использоваться в проекте Windows.

Я считаю, что windows.h имеет некоторые похожие функции.


1

anastaciu
30 Янв 2020 в 09:53

Some random crashes you may face on your Windows development machine.

1. Apache keep crashing every few hundred requests

In Apache error.log:

 AH00428: Parent: child process 6096 exited with status 3221226356 — Restarting.

Reason:

Apache’s default stack size is too small

Solution:

Add the following setting to httpd.conf

<IfModule mpm_winnt_module>
   ThreadStackSize 8388608
</IfModule>

Reference: http://www.codexpedia.com/apache-server/parent-child-process-exited-with-status-3221225725-restarting-on-xamp-apache/

Alternative Workaround: Use fastcgi instead of Apache module:

See: https://blog.tiger-workshop.com/wamp-development-machine-setup-note/

2. Apache random stop responding with Internet Explorer

Reason:

VMWare/VirtualBox network driver do not handle AcceptEx() correctly

Solution:

Add the following setting to httpd.conf

AcceptFilter https none 
AcceptFilter http none 
EnableSendfile Off 
EnableMMAP off

Reference: https://stijndewitt.com/2014/01/10/apache-hangs-ie11/

3. Apache still crashing with status 3221226356

Windows + PHP as Apache module is affected by this and other bugs that cause problems.
Switch to PHP as FCGI setup solve many problems, especially for server running Laravel.

1. Download a “non-thread safe” version of PHP

2. Create C:Apacheconfextrahttpd-php7.conf

LoadModule fcgid_module modules/mod_fcgid.so

<IfModule fcgid_module>
   FcgidMaxProcesses 300
   FcgidMaxProcessesPerClass 300

   FcgidOutputBufferSize 65536
   FcgidConnectTimeout 10
   FcgidProcessLifeTime 0
   FcgidMaxRequestsPerProcess 0
   FcgidMinProcessesPerClass 0
   FcgidFixPathinfo 0
   FcgidProcessLifeTime 0
   FcgidZombieScanInterval 20
   FcgidMaxRequestLen 536870912
   FcgidIOTimeout 120
   FcgidTimeScore 3

   FcgidPassHeader Authorization

   FcgidInitialEnv PHPRC "C:\PHP"
   FcgidInitialEnv PATH "C:\PHP;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;"
   FcgidInitialEnv SystemRoot "C:\Windows"
   FcgidInitialEnv SystemDrive "C:"
   FcgidInitialEnv TEMP "C:\WINDOWS\TEMP"
   FcgidInitialEnv TMP "C:\WINDOWS\TEMP"
   FcgidInitialEnv windir "C:\WINDOWS"

   DirectoryIndex index.html index.htm index.php

   <Files ~ ".php$">
      Options Indexes FollowSymLinks ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper "C:/PHP/php-cgi.exe" .php
   </Files>
</IfModule>

Edit C:Apacheconfhttpd.conf, Add

# PHP7
Include conf/extra/httpd-php7.conf

4. Still Crash?

Reinstall a PROPER WAMP stack following this guide.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Runtime error 217 at 00692077 mspeech ошибка
  • Runtime error 217 at 00580d29 autodata
  • Runtime error 5981 vba excel
  • Runtime error 3221225477
  • Runtime error 217 at 004bcf5f

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии