AWS SDK S3 ListObjectsV2 在 Photon 服务器中给出 NullReferenceException
AWS SDK S3 ListObjectsV2 gives NullReferenceException in Photon Server
我是 运行 来自 Photon Server 应用程序的 AWS SDK,并尝试使用基于 AWS 站点示例的 AmazonS3Client.ListObjectsV2() 方法查询 S3 存储桶的内容。在另一个应用程序中使用相同的代码工作得很好,但在 Photon Server 应用程序中它向 Photon logs
输出以下错误消息
2016-10-12 15:19:52,614 [11] ERROR Photon.SocketServer.ApplicationBase [(null)] - System.NullReferenceException: Object reference not set to an instance of an object.
at System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Configuration.UriSectionReader.GetSectionData()
at System.Configuration.UriSectionInternal.LoadUsingCustomParser(String appConfigFilePath)
at System.Configuration.UriSectionInternal.GetSection()
at System.Uri.InitializeUriConfig()
at System.Uri.InitializeUri(ParsingError err, UriKind uriKind, UriFormatException& e)
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at Amazon.Runtime.AmazonServiceClient.ComposeUrl(IRequest iRequest)
at Amazon.Runtime.Internal.HttpHandler`1.CreateWebRequest(IRequestContext requestContext)
at Amazon.Runtime.Internal.HttpHandler`1.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RedirectHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.Unmarshaller.InvokeSync(IExecutionContext executionContext)
at Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.AmazonServiceClient.Invoke[TRequest,TResponse](TRequest request, IMarshaller`2 marshaller, ResponseUnmarshaller unmarshaller)
at Amazon.S3.AmazonS3Client.ListObjectsV2(ListObjectsV2Request request)
at AWSConnector.AWSConnector.ListSubfolders(String prefix)
at InstanceManager.Handlers.InstanceManagerUpdateInstancesHandler.OnHandleMessage(IMessage message, PhotonServerPeer serverPeer)
at Boson.Photon.Server.PhotonServerHandlerList.HandleMessage(IMessage message, PhotonServerPeer peer)
at Boson.Photon.Server.PhotonServerPeer.OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
at Photon.SocketServer.ServerToServer.ServerPeerBase.OnReceiveInternal(Byte[] data, SendParameters sendParameters, Int32 rtt, Int32 rttVariance, Int32 numFailures)
at Photon.SocketServer.PeerBase.<>c__DisplayClass6.<Photon.SocketServer.IManagedPeer.Application_OnReceive>b__5()
at ExitGames.Concurrency.Core.DefaultExecutor.Execute(Action toExecute)
at ExitGames.Concurrency.Core.DefaultExecutor.Execute(List`1 toExecute)
at ExitGames.Concurrency.Fibers.PoolFiber.Flush(Object )
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
恐怕这可能与 Photon 中处理线程的方式有关。
不幸的是,我相信这里不涉及Photon和AWS。
"System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)" 方法在其他场景下会抛出 NRE。它似乎与 Microsoft 部署的最新安全修复程序一致。
例如,这是我现在正在努力处理的堆栈跟踪:
at System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Web.InternalSecurityPermissions.PathDiscovery(String path)
at System.Web.HttpRuntime.get_CodegenDir()
看来 .NET 4.6.2 是罪魁祸首。
比较 FileIOPermission 构造函数在无效路径上抛出 ArgumentException 的 FileIOPermission in 4.6.2 and FileIOPermission in 4.6.1 -- they obviously changed the illegal path checks, so the contract 已损坏。
我是 运行 来自 Photon Server 应用程序的 AWS SDK,并尝试使用基于 AWS 站点示例的 AmazonS3Client.ListObjectsV2() 方法查询 S3 存储桶的内容。在另一个应用程序中使用相同的代码工作得很好,但在 Photon Server 应用程序中它向 Photon logs
输出以下错误消息2016-10-12 15:19:52,614 [11] ERROR Photon.SocketServer.ApplicationBase [(null)] - System.NullReferenceException: Object reference not set to an instance of an object.
at System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Configuration.UriSectionReader.GetSectionData()
at System.Configuration.UriSectionInternal.LoadUsingCustomParser(String appConfigFilePath)
at System.Configuration.UriSectionInternal.GetSection()
at System.Uri.InitializeUriConfig()
at System.Uri.InitializeUri(ParsingError err, UriKind uriKind, UriFormatException& e)
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at Amazon.Runtime.AmazonServiceClient.ComposeUrl(IRequest iRequest)
at Amazon.Runtime.Internal.HttpHandler`1.CreateWebRequest(IRequestContext requestContext)
at Amazon.Runtime.Internal.HttpHandler`1.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RedirectHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.Unmarshaller.InvokeSync(IExecutionContext executionContext)
at Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.AmazonServiceClient.Invoke[TRequest,TResponse](TRequest request, IMarshaller`2 marshaller, ResponseUnmarshaller unmarshaller)
at Amazon.S3.AmazonS3Client.ListObjectsV2(ListObjectsV2Request request)
at AWSConnector.AWSConnector.ListSubfolders(String prefix)
at InstanceManager.Handlers.InstanceManagerUpdateInstancesHandler.OnHandleMessage(IMessage message, PhotonServerPeer serverPeer)
at Boson.Photon.Server.PhotonServerHandlerList.HandleMessage(IMessage message, PhotonServerPeer peer)
at Boson.Photon.Server.PhotonServerPeer.OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
at Photon.SocketServer.ServerToServer.ServerPeerBase.OnReceiveInternal(Byte[] data, SendParameters sendParameters, Int32 rtt, Int32 rttVariance, Int32 numFailures)
at Photon.SocketServer.PeerBase.<>c__DisplayClass6.<Photon.SocketServer.IManagedPeer.Application_OnReceive>b__5()
at ExitGames.Concurrency.Core.DefaultExecutor.Execute(Action toExecute)
at ExitGames.Concurrency.Core.DefaultExecutor.Execute(List`1 toExecute)
at ExitGames.Concurrency.Fibers.PoolFiber.Flush(Object )
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
恐怕这可能与 Photon 中处理线程的方式有关。
不幸的是,我相信这里不涉及Photon和AWS。 "System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)" 方法在其他场景下会抛出 NRE。它似乎与 Microsoft 部署的最新安全修复程序一致。
例如,这是我现在正在努力处理的堆栈跟踪:
at System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Web.InternalSecurityPermissions.PathDiscovery(String path)
at System.Web.HttpRuntime.get_CodegenDir()
看来 .NET 4.6.2 是罪魁祸首。
比较 FileIOPermission 构造函数在无效路径上抛出 ArgumentException 的 FileIOPermission in 4.6.2 and FileIOPermission in 4.6.1 -- they obviously changed the illegal path checks, so the contract 已损坏。