在过去的几天里,我们看到我们的服务器上的JVM进入一个状态,他们在OldGen的GC中花费100%的CPU时间,时间:
A.他们不需要,因为堆上有足够的空间
B.他们不回收任何东西.
我知道他们在GC中是通过查看堆栈跟踪并将ProcessExplorer中的ThreadID与堆栈转储中的ThreadID相关联.每个GC线程占用大约4%的CPU.
服务器运行16 gig堆(32gig物理RAM)并具有8个核心.正常运行时间通常为30天左右,只需要根据MS补丁要求重新启动,但目前它们在20天内崩溃.
这是持续时间,时间尺度= 19天的图表. http://i45.tinypic.com/257qalu.png
这是该图表尾部的缩放 http://i48.tinypic.com/2duiccw.png
如您所见,持续时间急剧增加.
下面是GC后堆使用情况的图表. http://i48.tinypic.com/znna4h.png
如果这是一个典型的内存泄漏,我希望看到橙色峰值越来越高,直到它们不再达到峰值,但如图所示,剩下大量的堆空间.
我有每个服务器的堆转储,没有什么是有问题的突出.有几个ehCache商店,我可以看到我们的应用程序代码,即只是"正常的东西"
我们在20天前做出的最大改变是实现了一个供应商补丁,它将内部缓存从使用硬引用(以及明显的内存泄漏)的无界散列图更改为由软引用组成的一个,我想知道这是否是原因,即某种程度上在管理这些软引用之后会产生巨大的开销?
有没有人想知道接下来要去哪里,或者有人可以证实我的软参考理论?
这是我的jvm.args:
java.args = -server -Xms16000m -Xmx16000m -Dsun.io.useCanonCaches = false -XX:MaxPermSize = 350m -Xloggc:e:/gcLogs/eRGCLogs.txt -verbose:gc -XX:+ PrintGCDetails -XX:+ PrintGCTimeStamps - XX:+ PrintGCDateStamps -XX:+ UseParallelGC -XX:+ UseParallelOldGC -Dnet.sf.ehcache.sizeof.filter = D:/jo3/java_ehCacheOpenSource/sizeOfExclusions.config -Xbatch -Dcoldfusion.rootDir = {application.home}/../-Dcoldfusion.libPath = {application.home} /../ lib -Dcoldfusion.classPath = {application.home} /../ lib/updates,{application.home} /../ lib,{application.home} /../gateway/lib/,{application.home}/../wwwroot/WEB-INF/flex/jars,{application.home}/../wwwroot/WEB-INF/cfform/jars,d:/ jo3/JAVA,d:/ jO3/java_ehCacheOpenSource /,d:/ jo3/java_ehCacheMonitorProbe
我们在Coldfusion上,这有点像一个位于java之上的庞大框架.
JVM版本:1.6.0_29
根据要求,"正常"GC日志如下所示:
2013-03-19T22:11:36.670 + 1100:1288665.702:[GC [PSYoungGen:4695800K-> 471119K(4722112K)] 9301727K-> 5077046K(15644800K),0.3584434 secs] [次:用户= 5.01 sys …
ColdFusion cookie会话cookie管理的常见"最佳实践"是实现类似这样的事情:
<cfset this.setClientCookies = false />
<cfif NOT IsDefined( "cookie.cfid" ) OR NOT IsDefined( "cookie.cftoken" )>
<cfcookie name="cfid" value="#session.cfid#" domain=".#cgi.HTTP_HOST#" path="/test/sessiontest">
<cfcookie name="cftoken" value="#session.cftoken#" domain=".#cgi.HTTP_HOST#" path="/test/sessiontest">
</cfif>
Run Code Online (Sandbox Code Playgroud)
要么
<cfif IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN")>
<cfcookie name="CFID" value="#Cookie.CFID#">
<cfcookie name="CFTOKEN" value="#Cookie.CFTOKEN#">
</cfif>
Run Code Online (Sandbox Code Playgroud)
取决于你与谁交谈.
Adobe随后发布了http://www.adobe.com/support/security/bulletins/apsb11-04.html以及后来针对此原始修复程序的修复程序,此处讨论了这个问题:http://www.shilpikhariwal.com/2011 /03/update-on-security-hot-fix-feb-2011.html
原始修复程序导致此处描述的许多问题:http://cfsimplicity.com/4/coldfusion-security-hotfix-changes-session-behaviour 此修复程序(以及Web上的许多其他类似修复程序)通过修改上面的cfcookie代码.
这是一年之后,我想知道当运行CF9.02时人们正在为CFID/CFToken管理做什么(即应用了会话固定修复程序).
我们目前正在C#中构建一个绿色领域的应用程序.我们有广泛的UI测试,使用Selenium Web Driver.这些测试(以及单元测试)由我们的CI服务器运行.
Selenium公开了一个.PageSource属性,对我来说,通过HTML5验证器运行该源作为每个UI测试的另一部分是有意义的.
我想了解http://validator.w3.org/所采用的相同类型的东西.作为奖励,我还想了解508个问题.
我的问题是我找不到任何可以在本地执行此操作的内容,并且很容易集成到我的UI测试中.W3C站点公开了一个SOAP api,但是我不想在CI过程中访问他们的站点.它们似乎也不支持获取SOAP响应.我想避免在本地安装完整的W3C服务器.
我看到的最接近的是http://www.totalvalidator.com/,使用它需要编写临时文件和解析报告.
在我走下这条赛道之前,我以为我会看到是否有人知道另一种方式.最好是我可以调用的DotNet组件.
C
我有一个管理用户事件,它采用可选的用户ID并显示用户编辑屏幕.这个屏幕有一个manageUserViewModel.
我的"管理"页面有一些依赖项 - 例如,PageTitle,要提交的方法等.
如果我验证失败,我需要再次显示管理屏幕,但这一次,使用传递到同一方法的视图模型.
在失败场景中提供这些依赖关系并不是很干.
如何重复依赖关系?我尝试将它们放入一个单独的方法中,但这感觉不对.
public ActionResult Manage(Guid? UserID)
{
User user = this._UserLogic.GetUser(UserID);
ViewBag.Title = "User List";
ViewBag.OnSubmit = "Save";
ManageUserViewModel uvm = Mapper.Map<User, ManageUserViewModel>(user);
return View("Manage", uvm);
}
[AcceptVerbs("POST")]
public ActionResult Save(ManageUserViewModel uvm)
{
User user = this._UserLogic.GetUser(uvm.UserID);
if (!ModelState.IsValid)
// This is not very DRY!!!
ViewBag.Title = "Manage User";
ViewBag.OnSubmit = "Save";
return View("Manage", uvm);
}
Mapper.Map<ManageUserViewModel, User>(uvm, user );
this._UserLogic.SaveUser(user);
return RedirectToAction("Manage", new { UserID = user.ID });
}
Run Code Online (Sandbox Code Playgroud) 如果我用一个(虚构的)例子解释这个问题,这可能是最简单的.
我有一个包含Order对象的nHibernate模型.此Order对象包含OrderItem nHibernate对象的集合.
我有一个Order ViewModel,它包含OrderItemDto的集合(实际上只是POCO).
在我的UI中,我显示了一个订单对象和一个OrderItems列表,它们在列表中是可编辑的.模型绑定负责填充OrderViewModel和OrderItemDto集合.
这是我的模特
namespace nHibernateModel
{
public class Order
{
private readonly IList<OrderItem> _OrderItems;
public int Id { get; set; }
public Order()
{
_OrderItems = new List<OrderItem>();
}
public IList<OrderItem> OrderItems
{
/* Setter does not exist to satisfy CA2227*/
get
{
return _OrderItems;
}
}
public void AddOrderItem(OrderItem orderItem)
{
//Set bi-directional relationships
if (_OrderItems.Contains(orderItem))
return;
orderItem.Order = this;
_OrderItems.Add(orderItem);
}
}
public class OrderItem
{
private readonly Order _Order;
public int Id { …Run Code Online (Sandbox Code Playgroud) 我们最近升级了一个 web/mvc 应用程序以使用 StrucutreMap 3.0.4
现在,当尝试在“Line Level Timings, All Methods with Source”或更高级别使用 RedGate Ant 的分析器分析应用程序时,我们收到以下错误
Operation could destabilize the runtime.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.VerificationException: Operation could destabilize the runtime.
Source Error:
Line 174:
Line 175: Initialise(context);
Line 176: ObjectFactory.Initialize(x => { x.AddRegistry<BWebsiteIoc>(); });
Line 177: }
Line 178: }
Source …Run Code Online (Sandbox Code Playgroud) 这是将ValidationResult分配给特定字段的类似问题 ?
我的视图模型如下所示:
[DisplayName("Password")]
[Required(ErrorMessage = "Password is required")]
[StringLength(3, ErrorMessage = "Password length Should be less than 3")]
public string Password { get; set; }
[DisplayName("Confirm Password")]
[Required(ErrorMessage = "Confirm Password is required")]
[StringLength(3, ErrorMessage = "Confirm Password length should be less than 3")]
public string ConfirmPassword { get; set; }
public static ValidationResult ExtendedValidation(ManageUserViewModel t)
{
if (t.Password == t.ConfirmPassword)
return ValidationResult.Success;
else
return new ValidationResult("Your passwords must match", new[] { "ConfirmPassword" });
}
Run Code Online (Sandbox Code Playgroud)
我的观点如下:
@Html.ValidationSummary(true, …Run Code Online (Sandbox Code Playgroud) 我在使用Constructor Injection的控制器中成功使用了ASP.NET 5/MVC 6 DI.
我现在有一个场景,我希望我的View Models在实现IValidatableObject时在Validate方法中使用utalise服务.
ViewModel中的构造函数注入不起作用,因为它们需要默认的无参数构造函数.验证Context.GetService也不起作用.
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
MyService myService = (MyService)validationContext.GetService(typeof(MyService));
Run Code Online (Sandbox Code Playgroud)
总是导致MyService为null.
ASP.NET 4,我将创建ValidatableObjectAdapter,通过DataAnnotationsModelValidatorProvider.RegisterDefaultValidatableObjectAdapterFactory注册它然后我可以使用validationContext来对象引用服务.
我目前正在使用用于ASP.NET 5的DI容器中的构建,将在某个阶段移动到结构图)而不是这应该重要.
我的具体验证是对象的属性(例如,用户名)是唯一的.我想将此测试委托给服务层.
我正在设法绕过oAuth2 / IdentityServer4。
在https://github.com/IdentityServer/IdentityServer4.Samples/tree/dev/Quickstarts/3_ImplicitFlowAuthentication使用示例应用程序
MVC应用程序中的以下代码:
@foreach (var claim in User.Claims)
{
<dt>@claim.Type</dt>
<dd>@claim.Value</dd>
}
Run Code Online (Sandbox Code Playgroud)
返回似乎是身份令牌声明的内容
NBF
1467173142
EXP
1467173442
ISS
的http://本地主机:5000
澳元
MVC
现时
636027699106782287.MDI0YzI5MTQtYmQxNy00MDllLWJmYzQtZjBhYzI2MGNjYmE3MDFmNzg1YmUtM2Y5ZC00YjBiLWEzOGItN2Q3ODRiODJlYjFl
IAT
1467173142
c_hash
H2i5QeJKlHM5-s8vUTYlOw
SID
42b58d38e2b7c6cc653492742a08840b
子
818727
auth_time
1467170555
IDP
idsvr
名
爱丽丝·史密斯
GIVEN_NAME
爱丽丝
FAMILY_NAME
史密斯
网站
http://alice.com
AMR
PWD
API项目中的以下代码
var claims = User.Claims.Select(c => new { c.Type, c.Value });
return new JsonResult(claims);
Run Code Online (Sandbox Code Playgroud)
返回似乎是访问令牌声明的内容
{
"Type": "nbf",
"Value": "1467173142"
},
{
"Type": "exp",
"Value": "1467176742"
},
{
"Type": "iss",
"Value": …Run Code Online (Sandbox Code Playgroud) c# ×3
coldfusion ×2
coldfusion-9 ×2
ants ×1
asp.net ×1
asp.net-core ×1
asp.net-mvc ×1
automapper-3 ×1
heap-dump ×1
heap-memory ×1
html5 ×1
java ×1
selenium ×1