Tag Archives: 500 Internal Server Error

[azure environment] notification hub failed to create policy: 500 internal server error occurred

Problem description

There is a problem with the notification hub and the policy (rule) cannot be created. Error message obtained:

Error: Error making Read request on Authorization Rule “notification-hub-auth-rule” (Notification Hub “nh-verify-notify”/Namespace “nh-verify-notify-namespace”/Resource Group “nh-state”) : notificationhubs.Client#GetAuthorizationRule: Failure responding to request: StatusCode=500 — Original Error: autorest/azure: error response cannot be parsed: “\”Internal Server Error\”” error: json: cannot unmarshal string into Go value of type azure.RequestError

When creating a policy through the azure notification hub portal, you encounter the same problem:

 

 

Question answer

After locating with the help of azure support, it is proved that this problem is a bug after the upgrade of notification hub service. Therefore, when a service on azure encounters a problem, after preliminarily eliminating the use error, the fastest solution is to find azure support to solve the problem:

https://support.azure.cn/zh-cn/support/support-azure  

 

How to Solve Ajax Error 500 (Internal Server Error)

==========error======={"readyState":4,"responseText":"<html><head><title>Apache Tomcat/6.0.35 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size=\"1\" noshade=\"noshade\"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Object is null (through reference chain: java.util.HashMap[&quot;data&quot;]-&>java.util.ArrayList[0]-&>net.sf.json.JSONObject[&quot;applyExcuse&quot;]-&>net.sf.json.JSONNull[&quot;empty&quot;]); nested exception is org.codehaus.jackson.map.JsonMappingException: Object is null (through reference chain: java.util.HashMap[&quot;data&quot;]-&>java.util.ArrayList[0]-&>net.sf.json.JSONObject[&quot;applyExcuse&quot;]-&>net.sf.json.JSONNull[&quot;empty&quot;])\n\torg.springframework.http.converter.json.MappingJacksonHttpMessageConverter.writeInternal(MappingJacksonHttpMessageConverter.java:194)\n\torg.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:179)\n\torg.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:148)\n\torg.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(……

Various explanations on the Internet, but not eggs

Error reported in “codeexception.Org” in “codeexception.Org”  ”   This means that there is null in the map value

 

Null values cannot be converted to JSON when the front end is returned

Ajax defines data transfer as JSON

Solution:

1. Loop by yourself or find a tool class to handle null ”

2. Returns the front-end string. The front end is converted to JSON.

Nginx report 500 internal server error

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

Today, a nginx is deployed. Web page access always reports 500 errors (500 internal server error). After entering the error.log of nginx, it is found that it has been reporting too many open files

2018/08/21 10:07:35 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:35 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:36 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:36 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:37 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:37 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:38 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:38 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:39 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:39 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:40 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:40 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:41 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:41 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:42 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:42 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:43 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:43 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:44 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:44 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:45 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:45 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:46 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:46 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:47 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:47 [crit] 13508#13508: accept4() failed (24: Too many open files)
2018/08/21 10:07:48 [crit] 13508#13508: accept4() failed (24: Too many open files)

I guess the file open is beyond the upper limit set by the system, so I log in to the server to check

Run the following command to view

[root@server nginx]$ ulimit -n  
1024
[root@server nginx]$ 

It’s only 1024. Since it’s so small, let’s revise it

But before we modify it, let’s confirm the upper limit of the system

[root@server nginx]# sysctl -n -e fs.file-max
13057331
[root@server nginx]# 

Since there are so many, I don’t worry. I don’t want many

Start to modify the maximum number of open files, in the/etc/security/limits. Conf file, and add

* soft nofile 10240
* hard nofile 10240

# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
#
#Also note that configuration files in /etc/security/limits.d directory,
#which are read in alphabetical order, override the settings in this
#file in case the domain is the same or more specific.
#That means for example that setting a limit for wildcard domain here
#can be overriden with a wildcard setting in a config file in the
#subdirectory, but a user specific setting here can be overriden only
#with a user specific setting in the subdirectory.
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - a user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open file descriptors
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4

* soft nofile 10240
* hard nofile 10240
# End of file

Then log out, go in and check it, and find that it has been set

[root@server nginx]$ ulimit -n  
10240
[root@server nginx]$ 

Then restart nginx, it should be OK